Skip to content

Commit fd11f17

Browse files
committed
Apply boolean check in the correct way.
1 parent d68a73b commit fd11f17

File tree

7 files changed

+12
-6
lines changed

7 files changed

+12
-6
lines changed

src/functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ const functions = (() => {
18301830
* @returns {undefined}
18311831
*/
18321832
function assert(condition, message) {
1833-
if(condition) {
1833+
if(!condition) {
18341834
throw {
18351835
code: "D3141",
18361836
stack: (new Error()).stack,

test/test-suite/groups/function-assert/case000.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"expr": "$assert(Account.Order[0].Product[0].Price > 34, 'Too Expensive')",
2+
"expr": "$assert(Account.Order[0].Product[0].Price < 34, 'Too Expensive')",
33
"dataset": "dataset5",
44
"bindings": {},
55
"error": {

test/test-suite/groups/function-assert/case001.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"expr": "$assert(Account.Order[0].Product[0].Price > 35, 'Too Expensive')",
2+
"expr": "$assert(Account.Order[0].Product[0].Price < 35, 'Too Expensive')",
33
"dataset": "dataset5",
44
"bindings": {},
55
"undefinedResult": true

test/test-suite/groups/function-assert/case002.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"expr": "($assert(Account.Order[0].Product[0].Price > 35, 'Too Expensive'); Account.Order[0].Product[0].Price)",
2+
"expr": "($assert(Account.Order[0].Product[0].Price < 35, 'Too Expensive'); Account.Order[0].Product[0].Price)",
33
"dataset": "dataset5",
44
"bindings": {},
55
"result": 34.45

test/test-suite/groups/function-assert/case003.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"expr": "($assert(Account.Order[0].Product[0].Price > 34, 'Too Expensive'); Account.Order[0].Product[0].Price)",
2+
"expr": "($assert(Account.Order[0].Product[0].Price < 34, 'Too Expensive'); Account.Order[0].Product[0].Price)",
33
"dataset": "dataset5",
44
"bindings": {},
55
"error": {

test/test-suite/groups/function-assert/case006.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"expr": "$assert(true)",
2+
"expr": "$assert(false)",
33
"dataset": "dataset5",
44
"bindings": {},
55
"error": {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"expr": "$assert(true)",
3+
"dataset": "dataset5",
4+
"bindings": {},
5+
"undefinedResult": true
6+
}

0 commit comments

Comments
 (0)