Adding more tests for YAQL length() function

Change-Id: Ic04387fd4c706a2b5c71aef12330303cc29c33f7
This commit is contained in:
Renat Akhmerov 2014-12-23 16:08:35 +06:00
parent 3f31817520
commit f26a81115a
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ Christian Berendt <berendt@b1-systems.de>
Dmitri Zimine <dz@stackstorm.com>
Jeremy Stanley <fungi@yuggoth.org>
Kirill Izotov <enykeev@stackstorm.com>
Lakshmi Kannan <lakshmi@stackstorm.com>
Manas Kelshikar <manas@stackstorm.com>
Nikolay Mahotkin <nmakhotkin@mirantis.com>
Ray Chen <chenrano2002@gmail.com>

View File

@ -72,6 +72,7 @@ class YaqlEvaluatorTest(base.BaseTest):
def test_function_length(self):
# Lists.
self.assertEqual(0, expr.evaluate('$.length()', []))
self.assertEqual(3, expr.evaluate('$.length()', [1, 2, 3]))
self.assertEqual(2, expr.evaluate('$.length()', ['one', 'two']))
self.assertEqual(4, expr.evaluate(
@ -100,6 +101,11 @@ class YaqlEvaluatorTest(base.BaseTest):
)
)
self.assertEqual(
0,
expr.evaluate("$[$.state = 'active'].length()", [])
)
class InlineYAQLEvaluatorTest(base.BaseTest):
def setUp(self):