Add set index in list, and update lib+examples+tests
This commit is contained in:
parent
8d12c0bdf8
commit
0f905a7fea
12 changed files with 117 additions and 60 deletions
|
|
@ -1,25 +1,25 @@
|
|||
|
||||
NAMESPACE := ""
|
||||
|
||||
func namespace(name: string, test: func()) {
|
||||
fn namespace(name: str, test: fn()) {
|
||||
NAMESPACE = name
|
||||
test()
|
||||
}
|
||||
|
||||
func assertEqual(a: any, b: any) {
|
||||
fn eq<T>(a: T, b: T) {
|
||||
if a != b {
|
||||
write(format("assertion error: % should (but doesn't) equal %", [a, b]))
|
||||
println(format("assertion error: % should (but doesn't) equal %", [a, b]))
|
||||
exit(1)
|
||||
} else if env("DEBUG") != "" {
|
||||
write(format("assertion success: % equals %", [a, b]))
|
||||
println(format("assertion success: % equals %", [a, b]))
|
||||
}
|
||||
}
|
||||
|
||||
func assertNotEqual(a: any, b: any) {
|
||||
fn neq<T>(a: T, b: T) {
|
||||
if a == b {
|
||||
write(format("assertion error: % shouldn't (but does) equal %", [a, b]))
|
||||
println(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]))
|
||||
println(format("assertion success: % doesn't equal %", [a, b]))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue