diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-02-02 15:48:28 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-02-02 15:49:42 -0800 |
| commit | 505fec2a61d2571317cc4bbc36ec0f4822a63f9d (patch) | |
| tree | c2b37e9db8e2f958fbca0caa0a9c4924912a37a9 /tests | |
| parent | 513c721198b2256235a95c98d161ab1bb51e6671 (diff) | |
Restructured the nomsu files to group all the essentials into core/ and
all the optionals into lib/. lib/core.nom and tests/all.nom are no
longer needed now.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/all.nom | 28 | ||||
| -rw-r--r-- | tests/collections.nom | 4 | ||||
| -rw-r--r-- | tests/control_flow.nom | 5 | ||||
| -rw-r--r-- | tests/math.nom | 4 | ||||
| -rw-r--r-- | tests/metaprogramming.nom | 4 | ||||
| -rw-r--r-- | tests/object.nom | 5 | ||||
| -rw-r--r-- | tests/operators.nom | 4 | ||||
| -rw-r--r-- | tests/text.nom | 4 |
8 files changed, 22 insertions, 36 deletions
diff --git a/tests/all.nom b/tests/all.nom deleted file mode 100644 index 5b95786..0000000 --- a/tests/all.nom +++ /dev/null @@ -1,28 +0,0 @@ -use "lib/core.nom" - -# Prerequisites: -%var <- 99 -assume (%var = 99) or barf "Var assignment doesn't work." - -try: barf "barf" -..and if it succeeds: barf "try % and if it succeeds failed." - -try: do nothing -..and if it barfs: barf "try % and if it barfs failed." - -immediately - assume (%ONCE is (nil)) or barf "immediately is executing twice" - export %ONCE <- "ONCE" - %foo <- "immediately local" -assume (%ONCE = "ONCE") or barf "Globals don't work." -assume (%foo is (nil)) or barf "Immediately is leaking locals." - -# Run per-file test suites -run file "tests/metaprogramming.nom" -run file "tests/text.nom" -run file "tests/operators.nom" -run file "tests/control_flow.nom" -run file "tests/math.nom" -run file "tests/collections.nom" - -say "All tests passed!" diff --git a/tests/collections.nom b/tests/collections.nom index ec79653..1c82487 100644 --- a/tests/collections.nom +++ b/tests/collections.nom @@ -1,7 +1,7 @@ #.. Tests for the stuff defined in lib/control_flow.nom -use "lib/core.nom" +use "core" assume ((2nd to last in [1,2,3,4,5]) = 4) assume ((first in [1,2]) = 1) @@ -41,3 +41,5 @@ assume ((unique [1,2,1,3,2,3]) = [1,2,3]) for all ["x","y","x","x","y"] (% in %c) +<- 1 assume (%c = {x:3,y:2}) + +say "Collections test passed." diff --git a/tests/control_flow.nom b/tests/control_flow.nom index 71d5f85..4ac3d8a 100644 --- a/tests/control_flow.nom +++ b/tests/control_flow.nom @@ -1,7 +1,8 @@ #.. Tests for the stuff defined in lib/control_flow.nom -use "lib/core.nom" +use "core" + do nothing action [test conditionals] @@ -189,3 +190,5 @@ try %x <- 1 ..and if it barfs: do nothing assume (%x = 1) or barf "do/then always failed" + +say "Control flow test passed." diff --git a/tests/math.nom b/tests/math.nom index 245fe52..4232d81 100644 --- a/tests/math.nom +++ b/tests/math.nom @@ -1,7 +1,7 @@ #.. Tests for the stuff defined in lib/control_flow.nom -use "lib/core.nom" +use "core" assume (all of [inf, pi, tau, golden ratio, e]) or barf "math constants failed" %nan <- (NaN) @@ -15,3 +15,5 @@ assume ..or barf "math functions failed" assume ((463 to the nearest 100) = 500) or barf "rounding failed" assume ((2.6 to the nearest 0.25) = 2.5) or barf "rounding failed" + +say "Math test passed" diff --git a/tests/metaprogramming.nom b/tests/metaprogramming.nom index 37acd3e..360771e 100644 --- a/tests/metaprogramming.nom +++ b/tests/metaprogramming.nom @@ -1,7 +1,7 @@ #.. Tests for the stuff defined in lib/metaprogramming.nom -use "lib/core.nom" +use "core" immediately compile [five] to {expr:"5"} @@ -53,3 +53,5 @@ assume ((nomsu) = (=lua "nomsu")) or barf "nomsu failed" assume (("x" as lua identifier) = (\%x as lua identifier)) or barf "converting to identifier failed." assume ((run "return 99") = 99) or barf "run % failed." + +say "Metaprogramming test passed." diff --git a/tests/object.nom b/tests/object.nom index 7dbaca6..84524e5 100644 --- a/tests/object.nom +++ b/tests/object.nom @@ -1,5 +1,5 @@ -use "lib/core.nom" -use "lib/object.nom" +use "core" +use "lib/object2.nom" immediately: define object "Dog": @@ -20,3 +20,4 @@ as %d: assume ("\(%d's "class")" = "Dog") assume ((%d's "barks") = 3) +say "Object test passed." diff --git a/tests/operators.nom b/tests/operators.nom index e3bd0b9..1a138cb 100644 --- a/tests/operators.nom +++ b/tests/operators.nom @@ -1,7 +1,7 @@ #.. Tests for the stuff defined in lib/operators.nom -use "lib/core.nom" +use "core" assume (({x:5}'s "x") = 5) or barf "indexing doesn't work." try: % <- ({}'s "[[[\n]]]") @@ -74,3 +74,5 @@ assume (%x = 2) or barf "+<- failed" assume (%x = 4) or barf "*<- failed" wrap %x around 3 assume (%x = 1) or barf "wrap around failed" + +say "Operator test passed." diff --git a/tests/text.nom b/tests/text.nom index ea18d42..2e08e45 100644 --- a/tests/text.nom +++ b/tests/text.nom @@ -1,7 +1,7 @@ #.. Tests for the stuff defined in lib/text.nom -use "lib/core.nom" +use "core" assume ((["x","y"] joined with ",") = "x,y") or barf "joined with failed" assume ((["x","y"] joined) = "xy") or barf "joined failed" @@ -11,3 +11,5 @@ assume (("asdf" with "X" instead of "s") = "aXdf") or barf "substitution failed" assume ("\n" = (newline)) or barf "Text literals failed." %x <- "\(green)hello\(reset color)" assume (("x" + "y") = "xy") + +say "Text test passed." |
