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

@ -156,26 +156,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -186,19 +175,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"right branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of and is false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"right branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "right branch of and is false makes the whole expression false"
}
}
],
"callee": {
@ -219,8 +215,24 @@ description: Result of parsing boolean_logical_and.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": "a",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -377,26 +389,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -407,19 +408,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"left branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of and is false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"left branch of and is false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "left branch of and is false makes the whole expression false"
}
}
],
"callee": {
@ -440,8 +448,24 @@ description: Result of parsing boolean_logical_and.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": "b",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -598,26 +622,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "1",
@ -628,19 +641,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 1.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are true makes the whole expression true"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are true makes the whole expression true\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are true makes the whole expression true"
}
}
],
"callee": {
@ -661,8 +681,24 @@ description: Result of parsing boolean_logical_and.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": "c",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",
@ -819,26 +855,15 @@ description: Result of parsing boolean_logical_and.kcl
"expression": {
"arguments": [
{
"commentStart": 0,
"end": 0,
"left": {
"abs_path": false,
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": {
"commentStart": 0,
"end": 0,
"name": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"name": "isEqualTo",
"start": 0,
"type": "Name",
"type": "Name"
"type": "Identifier"
},
"operator": "==",
"right": {
"arg": {
"commentStart": 0,
"end": 0,
"raw": "2",
@ -849,19 +874,26 @@ description: Result of parsing boolean_logical_and.kcl
"value": 2.0,
"suffix": "None"
}
},
"start": 0,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
},
{
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are false makes the whole expression false"
"type": "LabeledArg",
"label": {
"commentStart": 0,
"end": 0,
"name": "error",
"start": 0,
"type": "Identifier"
},
"arg": {
"commentStart": 0,
"end": 0,
"raw": "\"both branches of and are false makes the whole expression false\"",
"start": 0,
"type": "Literal",
"type": "Literal",
"value": "both branches of and are false makes the whole expression false"
}
}
],
"callee": {
@ -882,8 +914,24 @@ description: Result of parsing boolean_logical_and.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": "d",
"start": 0,
"type": "Identifier"
},
"path": [],
"start": 0,
"type": "Name",
"type": "Name"
}
},
"start": 0,
"type": "ExpressionStatement",

View File

@ -4,7 +4,7 @@ a = if aa {
} else {
2
}
assert(a == 2, "right branch of and is false makes the whole expression false")
assert(a, isEqualTo = 2, error = "right branch of and is false makes the whole expression false")
bb = false & true
b = if bb {
@ -12,7 +12,7 @@ b = if bb {
} else {
2
}
assert(b == 2, "left branch of and is false makes the whole expression false")
assert(b, isEqualTo = 2, error = "left branch of and is false makes the whole expression false")
cc = true & true
c = if cc {
@ -20,7 +20,7 @@ c = if cc {
} else {
2
}
assert(c == 1, "both branches of and are true makes the whole expression true")
assert(c, isEqualTo = 1, error = "both branches of and are true makes the whole expression true")
dd = false & false
d = if dd {
@ -28,4 +28,4 @@ d = if dd {
} else {
2
}
assert(d == 2, "both branches of and are false makes the whole expression false")
assert(d, isEqualTo = 2, error = "both branches of and are false makes the whole expression false")

View File

@ -8,7 +8,7 @@ a = if aa {
} else {
2
}
assert(a == 2, "right branch of and is false makes the whole expression false")
assert(a, isEqualTo = 2, error = "right branch of and is false makes the whole expression false")
bb = false & true
b = if bb {
@ -16,7 +16,7 @@ b = if bb {
} else {
2
}
assert(b == 2, "left branch of and is false makes the whole expression false")
assert(b, isEqualTo = 2, error = "left branch of and is false makes the whole expression false")
cc = true & true
c = if cc {
@ -24,7 +24,7 @@ c = if cc {
} else {
2
}
assert(c == 1, "both branches of and are true makes the whole expression true")
assert(c, isEqualTo = 1, error = "both branches of and are true makes the whole expression true")
dd = false & false
d = if dd {
@ -32,4 +32,4 @@ d = if dd {
} else {
2
}
assert(d == 2, "both branches of and are false makes the whole expression false")
assert(d, isEqualTo = 2, error = "both branches of and are false makes the whole expression false")