Kwargs: assert functions (#6406)

Closes https://github.com/KittyCAD/modeling-app/issues/6408
This commit is contained in:
Adam Chalmers
2025-04-22 12:44:52 -05:00
committed by GitHub
parent 8be36d3d16
commit f99e44e371
73 changed files with 4790 additions and 4034 deletions

View File

@ -173,26 +173,15 @@ description: Result of parsing boolean_logical_multiple.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "i",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -203,19 +192,26 @@ description: Result of parsing boolean_logical_multiple.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"and has higher precedence than or\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "and has higher precedence than or"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"and has higher precedence than or\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "and has higher precedence than or"
}
}
],
"callee": {
@ -236,8 +232,24 @@ description: Result of parsing boolean_logical_multiple.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "i",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -453,26 +465,15 @@ description: Result of parsing boolean_logical_multiple.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "j",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -483,19 +484,26 @@ description: Result of parsing boolean_logical_multiple.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"multiple logical operators\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "multiple logical operators"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"multiple logical operators\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "multiple logical operators"
}
}
],
"callee": {
@ -516,8 +524,24 @@ description: Result of parsing boolean_logical_multiple.kcl
"commentStart": 0,
"end": 0,
"start": 0,
"type": "CallExpression",
"type": "CallExpression"
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"abs_path": false,
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "j",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -4,7 +4,7 @@ i = if ii {
} else {
2
}
assert(i == 1, "and has higher precedence than or")
assert(i, isEqualTo = 1, error = "and has higher precedence than or")
jj = false | true & !false | false & true
j = if jj {
@ -12,4 +12,4 @@ j = if jj {
} else {
2
}
assert(j == 1, "multiple logical operators")
assert(j, isEqualTo = 1, error = "multiple logical operators")

View File

@ -8,7 +8,7 @@ i = if ii {
} else {
2
}
assert(i == 1, "and has higher precedence than or")
assert(i, isEqualTo = 1, error = "and has higher precedence than or")
jj = false | true & !false | false & true
j = if jj {
@ -16,4 +16,4 @@ j = if jj {
} else {
2
}
assert(j == 1, "multiple logical operators")
assert(j, isEqualTo = 1, error = "multiple logical operators")