improve errors, add warnings, add some compile-time optimizations, fix variables, make sure conditionals and loops get booleans, affirm types, keep variables to a single type
This commit is contained in:
parent
e34b423967
commit
b1b8e61f57
14 changed files with 435 additions and 118 deletions
|
|
@ -1,8 +1,17 @@
|
|||
|
||||
NAMESPACE := ""
|
||||
|
||||
func namespace(name: string, test: func()) {
|
||||
NAMESPACE = name
|
||||
test()
|
||||
}
|
||||
|
||||
func assertEqual(a: any, b: any) {
|
||||
if a != b {
|
||||
write(format("assertion error: % should (but doesn't) equal %", [a, b]))
|
||||
exit(1)
|
||||
} else if env("DEBUG") != "" {
|
||||
write(format("assertion success: % equals %", [a, b]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10,5 +19,7 @@ func assertNotEqual(a: any, b: any) {
|
|||
if a == b {
|
||||
write(format("assertion error: % shouldn't (but does) equal %", [a, b]))
|
||||
exit(1)
|
||||
} else if env("DEBUG") != "" {
|
||||
write(format("assertion success: % doesn't equal %", [a, b]))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue