change argument syntax to use $ instead of {}
This commit is contained in:
parent
5c56a5c87c
commit
f402a45a40
|
@ -62,7 +62,7 @@ struct key_path : list< seq< sor< alpha, one< '_' > >, star< sor< alnum, one< '_
|
|||
|
||||
// argument
|
||||
struct argument_index : plus< digit > {};
|
||||
struct argument : seq< one< '{' >, must< argument_index, one< '}' > > > {};
|
||||
struct argument : seq< one< '$' >, must< argument_index > > {};
|
||||
|
||||
// expressions and operators
|
||||
struct expr : sor< dq_string, sq_string, number, argument, true_value, false_value, key_path > {};
|
||||
|
|
|
@ -30,8 +30,8 @@ static std::vector<std::string> valid_queries = {
|
|||
"_ = a",
|
||||
"_a = _.aZ",
|
||||
"a09._br.z = __-__.Z-9",
|
||||
"{0} = {19}",
|
||||
"{0} = {0}",
|
||||
"$0 = $19",
|
||||
"$0=$0",
|
||||
|
||||
// operators
|
||||
"0=0",
|
||||
|
@ -75,10 +75,10 @@ static std::vector<std::string> invalid_queries = {
|
|||
"- = a",
|
||||
"a..b = a",
|
||||
"a$a = a",
|
||||
"{} = {0}",
|
||||
"{-1} = {0}",
|
||||
"{a} = {0}",
|
||||
"{ = }",
|
||||
"{} = $0",
|
||||
"$-1 = $0",
|
||||
"$a = $0",
|
||||
"$ = $",
|
||||
|
||||
// operators
|
||||
"0===>0",
|
||||
|
|
|
@ -273,10 +273,10 @@ module.exports = BaseTest.extend({
|
|||
TestCase.assertEqual(realm.objects('PersonObject', 'married == TRUE').length, 1);
|
||||
TestCase.assertEqual(realm.objects('PersonObject', 'married == false').length, 3);
|
||||
|
||||
TestCase.assertEqual(realm.objects('PersonObject', 'name = {0}', 'Tim').length, 1);
|
||||
TestCase.assertEqual(realm.objects('PersonObject', 'age > {1} && age < {0}', 13, 10).length, 3);
|
||||
TestCase.assertEqual(realm.objects('PersonObject', 'name = $0', 'Tim').length, 1);
|
||||
TestCase.assertEqual(realm.objects('PersonObject', 'age > $1 && age < $0', 13, 10).length, 3);
|
||||
TestCase.assertThrows(function() {
|
||||
realm.objects('PersonObject', 'age > {2} && age < {0}', 13, 10)
|
||||
realm.objects('PersonObject', 'age > $2 && age < $0', 13, 10)
|
||||
});
|
||||
|
||||
realm.write(function() {
|
||||
|
@ -285,8 +285,8 @@ module.exports = BaseTest.extend({
|
|||
realm.create('DefaultValuesObject', {'dateCol': new Date(5)});
|
||||
});
|
||||
|
||||
TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol > {0}', new Date(4)).length, 1);
|
||||
TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol <= {0}', new Date(4)).length, 2);
|
||||
TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol > $0', new Date(4)).length, 1);
|
||||
TestCase.assertEqual(realm.objects('DefaultValuesObject', 'dateCol <= $0', new Date(4)).length, 2);
|
||||
},
|
||||
|
||||
testNotifications: function() {
|
||||
|
|
Loading…
Reference in New Issue