Kwargs: assert functions (#6406)
Closes https://github.com/KittyCAD/modeling-app/issues/6408
This commit is contained in:
@ -8,8 +8,8 @@ obj = { foo = 1, bar = 0 }
|
||||
|
||||
one_a = obj["foo"]
|
||||
|
||||
assertLessThanOrEq(one_a, 1, "Literal property lookup")
|
||||
assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
|
||||
assert(one_a, isLessThanOrEqual = 1, error = "Literal property lookup")
|
||||
assert(one_a, isGreaterThanOrEqual = 1, error = "Literal property lookup")
|
||||
|
||||
// Test: the property is a variable,
|
||||
// which must be evaluated before looking it up.
|
||||
@ -18,8 +18,8 @@ assertGreaterThanOrEq(one_a, 1, "Literal property lookup")
|
||||
p = "foo"
|
||||
one_b = obj[p]
|
||||
|
||||
assertLessThanOrEq(one_b, 1, "Computed property lookup")
|
||||
assertGreaterThanOrEq(one_b, 1, "Computed property lookup")
|
||||
assert(one_b, isLessThanOrEqual = 1, error = "Computed property lookup")
|
||||
assert(one_b, isGreaterThanOrEqual = 1, error = "Computed property lookup")
|
||||
|
||||
// Test: multiple literal properties.
|
||||
|
||||
@ -28,13 +28,13 @@ obj2 = { inner = obj }
|
||||
|
||||
one_c = obj2.inner["foo"]
|
||||
|
||||
assertLessThanOrEq(one_c, 1, "Literal property lookup")
|
||||
assertGreaterThanOrEq(one_c, 1, "Literal property lookup")
|
||||
assert(one_c, isLessThanOrEqual = 1, error = "Literal property lookup")
|
||||
assert(one_c, isGreaterThanOrEqual = 1, error = "Literal property lookup")
|
||||
|
||||
// Test: multiple properties, mix of literal and computed.
|
||||
|
||||
|
||||
one_d = obj2.inner[p]
|
||||
|
||||
assertLessThanOrEq(one_d, 1, "Computed property lookup")
|
||||
assertGreaterThanOrEq(one_d, 1, "Computed property lookup")
|
||||
assert(one_d, isLessThanOrEqual = 1, error = "Computed property lookup")
|
||||
assert(one_d, isGreaterThanOrEqual = 1, error = "Computed property lookup")
|
||||
|
Reference in New Issue
Block a user