Actually removing the tests now that they're inline.
This commit is contained in:
parent
5224199fcf
commit
d38020bc5a
4
Makefile
4
Makefile
@ -47,7 +47,7 @@ optimize: build $(CORE_LUA_FILES) $(LIB_LUA_FILES)
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "\033[1mDeleting...\033[0m"
|
||||
@rm -rvf version core/*.lua lib/*.lua tools/*.lua tests/*.lua compatibility/*.lua
|
||||
@rm -rvf version core/*.lua lib/*.lua tools/*.lua compatibility/*.lua
|
||||
|
||||
.PHONY: install
|
||||
install: build version optimize
|
||||
@ -68,7 +68,7 @@ install: build version optimize
|
||||
&& chmod +x $$prefix/bin/nomsu$$version \
|
||||
&& cp -v nomsu $$prefix/bin \
|
||||
&& cp -v doc/nomsu.1 $$prefix/share/man/man1 \
|
||||
&& cp -rv $(LUA_FILES) $(PEG_FILES) core lib compatibility tools tests $$prefix/share/nomsu/$$version;
|
||||
&& cp -rv $(LUA_FILES) $(PEG_FILES) core lib compatibility tools $$prefix/share/nomsu/$$version;
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall: version
|
||||
|
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#..
|
||||
Tests for the stuff defined in core/control_flow.nom
|
||||
use "core"
|
||||
|
||||
assume ((2 nd to last in [1, 2, 3, 4, 5]) == 4)
|
||||
assume (3 is in [1, 2, 3, 4, 5])
|
||||
assume (99 isn't in [1, 2, 3])
|
||||
assume ({x:no} has key "x")
|
||||
assume ({x:no} doesn't have key "y")
|
||||
assume (not ({x:no} doesn't have key "x"))
|
||||
assume ((length of [1, 2, 3]) == 3)
|
||||
%list = [1, 2, 3, 4, 5]
|
||||
append 6 to %list
|
||||
assume ((last in %list) == 6)
|
||||
pop from %list
|
||||
assume ((last in %list) == 5)
|
||||
remove index 1 from %list
|
||||
assume ((first in %list) == 2)
|
||||
assume (((% * %) for % in [1, 2, 3]) == [1, 4, 9])
|
||||
assume ((%k = (%v * %v) for %k = %v in {x:1, y:2, z:3}) == {x:1, y:4, z:9})
|
||||
assume ((%k for %k = %v in {x:1}) == ["x"])
|
||||
assume ((% = (% * %) for % in [1, 2, 3]) == {1:1, 2:4, 3:9})
|
||||
assume (([[1, 2], [3, 4]] flattened) == [1, 2, 3, 4])
|
||||
assume ((entries in {x:1}) == [{key:"x", value:1}])
|
||||
assume ((keys in {x:1}) == ["x"])
|
||||
assume ((values in {x:1}) == [1])
|
||||
assume ((sorted [3, 1, 2]) == [1, 2, 3])
|
||||
%x = [3, 1, 2]
|
||||
sort %x
|
||||
assume (%x == [1, 2, 3])
|
||||
sort %x by % = (- %)
|
||||
assume (%x == [3, 2, 1])
|
||||
%keys = {1:999, 2:0, 3:50}
|
||||
sort %x by % = %keys.%
|
||||
assume (%x == [2, 3, 1])
|
||||
assume ((unique [1, 2, 1, 3, 2, 3]) == [1, 2, 3])
|
||||
say "Collections test passed."
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
use "lib/consolecolor.nom"
|
||||
|
||||
say (bright (green "Color test passed."))
|
@ -1,176 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#
|
||||
Tests for the stuff defined in core/control_flow.nom
|
||||
|
||||
use "core"
|
||||
|
||||
do nothing
|
||||
action [test conditionals]:
|
||||
if (yes): %loc1 = (yes)
|
||||
if (no):
|
||||
barf "entered if 'no' conditional"
|
||||
unless (yes):
|
||||
barf "entered unless 'yes' conditional"
|
||||
if (yes): %loc2 = (yes)
|
||||
..else:
|
||||
barf "entered if 'yes' else conditional"
|
||||
|
||||
unless (no) (%loc3 = (yes)) else (barf "entered unless 'no' else conditional")
|
||||
|
||||
assume (all of [%loc1 == (nil), %loc2 == (nil), %loc3 == (nil)]) or barf ".."
|
||||
conditionals leaking locals
|
||||
|
||||
assume ((5 if (yes) else 1) == 5)
|
||||
assume ((5 if (no) else 1) == 1)
|
||||
action [return nil] (return (nil))
|
||||
assume (((return nil) if (yes) else 99) == (nil))
|
||||
go to %skip
|
||||
barf "go-to failed."
|
||||
--- %skip ---
|
||||
%tot = 0
|
||||
for %x in [1, 2, 3]: %tot += %x
|
||||
assume (%tot == 6) or barf "for-loop failed"
|
||||
%x = 0
|
||||
repeat:
|
||||
%x += 1
|
||||
if (%x == 3): stop repeating
|
||||
if (%x > 3):
|
||||
barf "Failed to stop repeat loop"
|
||||
|
||||
assume (%x == 3) or barf "Failed to repeat"
|
||||
%x = 0
|
||||
repeat 5 times: %x += 1
|
||||
assume (%x == 5) or barf "Failed to repeat 5 times"
|
||||
set {%x:0, %y:0}
|
||||
for % in [1, 2, 3]:
|
||||
repeat 5 times:
|
||||
do next repeat
|
||||
%x += 1
|
||||
|
||||
%y += 1
|
||||
|
||||
assume ([%x, %y] == [0, 3]) or barf "Failed to continue repeat"
|
||||
set {%x:0, %y:0}
|
||||
for % in [1, 2, 3]:
|
||||
repeat 5 times:
|
||||
do next %
|
||||
%x += 1
|
||||
|
||||
%y += 1
|
||||
|
||||
assume ([%x, %y] == [0, 0]) or barf "Failed to continue for"
|
||||
set {%x:0, %y:0}
|
||||
for % in [1, 2, 3]:
|
||||
repeat 5 times:
|
||||
stop repeating
|
||||
%x += 1
|
||||
|
||||
%y += 1
|
||||
|
||||
assume ([%x, %y] == [0, 3]) or barf "Failed to stop repeat"
|
||||
set {%x:0, %y:0}
|
||||
for % in [1, 2, 3]:
|
||||
repeat 5 times:
|
||||
stop %
|
||||
%x += 1
|
||||
|
||||
%y += 1
|
||||
|
||||
assume ([%x, %y] == [0, 0]) or barf "Failed to stop for"
|
||||
%x = 0
|
||||
repeat while (%x < 10): %x += 1
|
||||
assume (%x == 10) or barf "repeat-while failed"
|
||||
%x = 0
|
||||
repeat until (%x == 10): %x += 1
|
||||
assume (%x == 10) or barf "repeat-until failed"
|
||||
%x = 0
|
||||
for %i in 1 to 3: %x += %i
|
||||
assume (%x == 6) or barf "Numeric for range failed"
|
||||
%x = 0
|
||||
for %i in 3 to 1 via -1: %x += %i
|
||||
assume (%x == 6) or barf "backwards numeric for range failed"
|
||||
%result = {}
|
||||
for %key = %value in {x:1, y:2}:
|
||||
%result."\%key\%key" = (%value * 11)
|
||||
|
||||
assume (%result == {xx:11, yy:22}) or barf "key/value iteration failed"
|
||||
for %key = %value in {x:1, y:2}:
|
||||
stop %key
|
||||
barf "stopping key failed"
|
||||
|
||||
for %key = %value in {x:1, y:2}:
|
||||
stop %value
|
||||
barf "stopping value failed"
|
||||
|
||||
for %key = %value in {x:1}:
|
||||
stop %key
|
||||
stop %value
|
||||
do next %key
|
||||
do next %value
|
||||
|
||||
for %key = %value in {x:1, y:2}:
|
||||
do next %key
|
||||
barf "skipping key failed"
|
||||
|
||||
for %key = %value in {x:1, y:2}:
|
||||
do next %value
|
||||
barf "skipping value failed"
|
||||
|
||||
action [barfer]:
|
||||
barf "this should never be reached"
|
||||
|
||||
if:
|
||||
(no): barf "'when' fail"
|
||||
(no) (3 > 4):
|
||||
barf "'when' fail 2"
|
||||
(yes) (barfer): do nothing
|
||||
(99 > 1):
|
||||
barf "Fell through incorrectly"
|
||||
|
||||
%else_worked = (no)
|
||||
if:
|
||||
(no): barf
|
||||
else:
|
||||
%else_worked = (yes)
|
||||
|
||||
assume %else_worked or barf "when..else failed"
|
||||
action [test when scope]:
|
||||
if (yes): %leaked = (yes)
|
||||
|
||||
test when scope
|
||||
assume (not %leaked) or barf "'when' is leaking locals"
|
||||
%when_worked = (no)
|
||||
if 4 is:
|
||||
1 2:
|
||||
barf "'when = ?' fail"
|
||||
3 4 (barfer):
|
||||
%when_worked = (yes)
|
||||
|
||||
assume %when_worked
|
||||
%when_worked = (no)
|
||||
if 5 is:
|
||||
6: barf
|
||||
else:
|
||||
%when_worked = (yes)
|
||||
|
||||
assume %when_worked
|
||||
%x = 1
|
||||
do: %x = 2
|
||||
assume (%x == 2) or barf "'do' is redefining locals"
|
||||
assume (..)
|
||||
(..)
|
||||
result of:
|
||||
%n = 0
|
||||
for % in [1, 2, 3]: %n += %
|
||||
return %n
|
||||
..== 6
|
||||
|
||||
%t = [1, [2, [[3], 4], 5, [[[6]]]]]
|
||||
%flat = []
|
||||
for % in recursive %t:
|
||||
if ((type of %) is "table"):
|
||||
for %2 in %: recurse % on %2
|
||||
..else: add % to %flat
|
||||
|
||||
assume ((sorted %flat) == [1, 2, 3, 4, 5, 6])
|
||||
say "Control flow test passed."
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#
|
||||
Tests for the stuff defined in core/control_flow.nom
|
||||
|
||||
use "core"
|
||||
|
||||
%nums = []
|
||||
%co = (..)
|
||||
coroutine:
|
||||
-> 4
|
||||
-> 5
|
||||
repeat 3 times: -> 6
|
||||
|
||||
for % in coroutine %co (add % to %nums)
|
||||
assume (%nums == [4, 5, 6, 6, 6]) or barf "Coroutine iteration failed"
|
||||
say "Coroutines test passed."
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#
|
||||
Tests for the stuff defined in core/errors.nom
|
||||
|
||||
try (barf) and if it succeeds (barf "try failed.")
|
||||
%worked = (no)
|
||||
try (barf) and if it barfs (%worked = (yes))
|
||||
assume %worked or barf "try/catch failed"
|
||||
%x = 1
|
||||
try:
|
||||
%x = 2
|
||||
do (barf) then always (%x = 3)
|
||||
..and if it barfs (do nothing)
|
||||
|
||||
assume (%x == 3) or barf "do/then always failed"
|
||||
say "Error handling test passed."
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
use "core"
|
||||
|
||||
say "Inner directory 'use' test passed."
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#..
|
||||
Tests for the stuff defined in core/control_flow.nom
|
||||
use "core"
|
||||
|
||||
assume (all of [inf, pi, tau, golden ratio, e]) or barf "math constants failed"
|
||||
%nan = (NaN)
|
||||
assume (%nan != %nan) or barf "NaN failed"
|
||||
assume (("5" as a number) == 5)
|
||||
assume (..)
|
||||
all of [..]
|
||||
abs 5, | 5 |, sqrt 5, √ 5, sine 5, cosine 5, tangent 5, arc sine 5, arc cosine 5
|
||||
arc tangent 5, arc tangent 5 / 10, hyperbolic sine 5, hyperbolic cosine 5
|
||||
hyperbolic tangent 5, e^ 5, ln 5, log base 2 of 5, floor 5, ceiling 5, round 5
|
||||
..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"
|
||||
assume ((min of [3, -4, 1, 2] by % = (% * %)) == 1)
|
||||
assume ((max of [3, -4, 1, 2] by % = (% * %)) == -4)
|
||||
say "Math test passed"
|
@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#
|
||||
Tests for the stuff defined in core/metaprogramming.nom
|
||||
|
||||
use "core"
|
||||
|
||||
compile [five] to (Lua value "5")
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
assume ((five) == 5) or barf "Compile to expression failed."
|
||||
compile [loc x] to (Lua "local _x = 99;")
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
lua> "do"
|
||||
loc x
|
||||
assume (%x is 99) or barf "Compile to statements with locals failed."
|
||||
lua> "end"
|
||||
assume (%x is (nil)) or barf "Failed to properly localize a variable."
|
||||
compile [asdf] to:
|
||||
%tmp = ""
|
||||
return (Lua %tmp)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
asdf
|
||||
assume (%tmp is (nil)) or barf "compile to is leaking variables"
|
||||
action [foo %x]:
|
||||
%y = (%x + 1)
|
||||
return %y
|
||||
|
||||
assume ((foo 10) == 11) or barf "Action didn't work."
|
||||
assume (%y is (nil)) or barf "Action leaked a local into globals."
|
||||
parse [baz %] as (foo %)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
assume ((baz 10) == 11) or barf "Parse as action failed."
|
||||
parse [V] as (five)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
assume ((V) == 5) or barf "Parse as compile action failed."
|
||||
parse [swap %x and %y] as (..)
|
||||
do:
|
||||
%tmp = %x
|
||||
%x = %y
|
||||
%y = %tmp
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
set {%1:1, %2:2}
|
||||
swap %1 and %2
|
||||
assume ((%1 == 2) and (%2 == 1)) or barf ".."
|
||||
'parse % as %' failed on 'swap % and %'
|
||||
|
||||
set {%tmp:1, %tmp2:2}
|
||||
swap %tmp and %tmp2
|
||||
assume ((%tmp == 2) and (%tmp2 == 1)) or barf ".."
|
||||
'parse % as %' variable mangling failed.
|
||||
|
||||
#
|
||||
remove action (foo %)
|
||||
try: foo 99
|
||||
..and if it succeeds: barf "Failed to delete action"
|
||||
|
||||
assume ((\(5 + 5) as value) == 10) or barf "%tree as value failed."
|
||||
assume ("\(\(foo %x) as nomsu)" == "foo %x") or barf ".."
|
||||
action source code failed.
|
||||
|
||||
assume ("\(\%x as nomsu)" == "%x") or barf "var source code failed."
|
||||
assume ((type of {}) == "table") or barf "type of failed."
|
||||
assume ("\(\%x as lua identifier)" == "_x") or barf ".."
|
||||
converting to identifier failed.
|
||||
|
||||
assume ((run "return 99") == 99) or barf "run % failed."
|
||||
%code = (Lua "global_x = true;")
|
||||
lua> %code
|
||||
assume (=lua "global_x") or barf "Running lua from a variable failed."
|
||||
%code = (Lua value "global_x")
|
||||
assume (=lua %code) or barf "Running lua from a variable failed."
|
||||
say "Metaprogramming test passed."
|
@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#
|
||||
Tests for the object model defined in lib/object.nom
|
||||
|
||||
use "core"
|
||||
use "lib/object.nom"
|
||||
|
||||
object "Dog":
|
||||
(class Dog).genus = "Canus"
|
||||
method [initialize %] (%.barks or= 0)
|
||||
method [bark, woof]:
|
||||
%barks = ("Bark!" for % in 1 to (me).barks)
|
||||
return (%barks joined with " ")
|
||||
|
||||
method [get pissed off] ((me).barks += 1)
|
||||
|
||||
%d = (new Dog {barks:2})
|
||||
as %d:
|
||||
assume ((me) == %d)
|
||||
assume ((me).barks == 2)
|
||||
assume ((bark) == "Bark! Bark!")
|
||||
assume ((woof) == "Bark! Bark!")
|
||||
get pissed off
|
||||
assume ((me).barks == 3)
|
||||
assume ((bark) == "Bark! Bark! Bark!")
|
||||
assume ((me).genus == "Canus")
|
||||
|
||||
assume ("\(%d.class)" == "Dog")
|
||||
assume (%d.genus == "Canus")
|
||||
assume (%d.barks == 3)
|
||||
as (new Dog) (assume ((me).barks == 0) or barf "Default initializer failed")
|
||||
as (new Dog {barks:1}) (assume ((bark) == "Bark!"))
|
||||
action [foo] (as (new Dog {barks:23}) (return (me).barks))
|
||||
assume ((foo) == 23) or barf "Oops, \(foo) != 23"
|
||||
as (new Dog {barks:101}):
|
||||
try (as (new Dog {barks:8}) (barf)) and if it succeeds (barf)
|
||||
assume ((me).barks == 101) or barf ".."
|
||||
Error in nested 'as % %' failed to properly reset 'self'
|
||||
|
||||
object "Corgi" extends (class Dog) (method [sploot] "splooted")
|
||||
%corg = (new Corgi)
|
||||
assume (%corg.barks == 0)
|
||||
as (new Corgi {barks:1}):
|
||||
assume ((sploot) == "splooted") or barf "subclass method failed"
|
||||
assume ((bark) == "Bark!") or barf "inheritance failed"
|
||||
assume ((woof) == "Bark!")
|
||||
|
||||
say "Object test passed."
|
@ -1,79 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#..
|
||||
Tests for the stuff defined in core/operators.nom
|
||||
use "core"
|
||||
|
||||
set {%x:10, %y:20}
|
||||
assume ((%x == 10) and (%y == 20)) or barf "mutli-assignment failed."
|
||||
set {%x:%y, %y:%x}
|
||||
assume ((%y == 10) and (%x == 20)) or barf "swapping vars failed."
|
||||
% = [..]
|
||||
%x < %y, %x <= %y, %x > %y, %x >= %y, %x == %y, %x is %y, %x != %y, %x isn't %y
|
||||
%x is not %y
|
||||
|
||||
assume ({} is {}) or barf "Equality check failed."
|
||||
assume (({} 's id) is not ({} 's id)) or barf "Identity check failed."
|
||||
set {%foozle:"outer", %y:"outer"}
|
||||
action [set global x local y]:
|
||||
external %foozle = "inner"
|
||||
%y = "inner"
|
||||
|
||||
set global x local y
|
||||
assume ((%foozle == "inner") and (%y == "outer")) or barf "external failed."
|
||||
set {%foozle:"outer", %y:"outer"}
|
||||
action [set global x local y] (..)
|
||||
with external [%foozle]:
|
||||
%foozle = "inner"
|
||||
%y = "inner"
|
||||
|
||||
set global x local y
|
||||
assume ((%foozle == "inner") and (%y == "outer")) or barf ".."
|
||||
'with external' failed.
|
||||
|
||||
set {%x:1, %y:2}
|
||||
with {%z:nil, %x:999}:
|
||||
%z = 999
|
||||
assume (%z == 999) or barf "'with' failed."
|
||||
assume (%x == 999) or barf "'with' assignment failed."
|
||||
|
||||
assume (%x == 1) or barf "'with' scoping failed"
|
||||
assume (%z == (nil)) or barf "'with' scoping failed"
|
||||
assume ((1 + 2 * 3 - 4 / 2 ^ 2) == 6) or barf ".."
|
||||
math expressions not working properly
|
||||
|
||||
assume ((5 wrapped around 2) == 1) or barf "mod not working"
|
||||
assume (1 <= 2 < 3) or barf "chained operator fail."
|
||||
%value = -999
|
||||
action [flipflop]:
|
||||
external %value = (- %value)
|
||||
return %value
|
||||
|
||||
assume (not (1 < (flipflop) < 1)) or barf ".."
|
||||
3-way inequality evaluated middle term twice
|
||||
|
||||
assume (((yes) and (yes)) == (yes))
|
||||
action [barfer] (barf "short circuiting failed")
|
||||
assume (((no) and (barfer)) == (no))
|
||||
assume ((no) or (yes))
|
||||
assume ((yes) or (barfer))
|
||||
|
||||
# Disabled because luajit doesn't have bitops
|
||||
assume ((1 OR 2) = 3)
|
||||
assume ((3 XOR 2) = 1)
|
||||
assume ((3 AND 2) = 2)
|
||||
assume ((NOT (NOT 6)) = 6)
|
||||
assume ((1<<1) = 2)
|
||||
assume ((2>>1) = 1)
|
||||
assume ((2>>>1) = 1)
|
||||
#.. Ugh, Lua is stupid when it comes to bitwise arithmetic on negative numbers, so I'm
|
||||
skipping the tests for those.
|
||||
assume ((- 5) == -5)
|
||||
assume ((not (yes)) == (no))
|
||||
%x = 1
|
||||
%x += 1
|
||||
assume (%x == 2) or barf "+<- failed"
|
||||
%x *= 2
|
||||
assume (%x == 4) or barf "*<- failed"
|
||||
wrap %x around 3
|
||||
assume (%x == 1) or barf "wrap around failed"
|
||||
say "Operator test passed."
|
13
tests/os.nom
13
tests/os.nom
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#
|
||||
Tests for the stuff defined in lib/os.nom
|
||||
|
||||
use "core"
|
||||
use "lib/os.nom"
|
||||
|
||||
%lines = (lines in (read file "tests/os.nom"))
|
||||
assume (%lines.3 == " Tests for the stuff defined in lib/os.nom")
|
||||
%n = 0
|
||||
for file %f in "core" (%n += 1)
|
||||
assume (%n > 0) or barf "Failed to walk the 'core' directory"
|
||||
say "OS test passed."
|
@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
use "core"
|
||||
|
||||
%x = "outer"
|
||||
with local %x:
|
||||
%x = "inner"
|
||||
assume (%x == "inner")
|
||||
|
||||
assume (%x == "outer")
|
||||
action [foo] "outer foo"
|
||||
with local [action (foo)]:
|
||||
action [foo] "inner foo"
|
||||
assume ((foo) == "inner foo")
|
||||
|
||||
assume ((foo) == "outer foo")
|
||||
say "Scopes test passed."
|
@ -1,51 +0,0 @@
|
||||
#!/usr/bin/env nomsu -V2.5.4.3
|
||||
#..
|
||||
Tests for the stuff defined in core/text.nom
|
||||
use "core"
|
||||
|
||||
assume ((["x", "y"] joined with ",") == "x,y") or barf "joined with failed"
|
||||
assume ((["x", "y"] joined) == "xy") or barf "joined failed"
|
||||
assume (("asdf" capitalized) == "Asdf") or barf "capitalized failed"
|
||||
assume (("asdf" with "X" instead of "s") == "aXdf") or barf ".."
|
||||
substitution failed
|
||||
|
||||
assume ("\n" == (newline)) or barf "Text literals failed."
|
||||
assume (("x" + "y") == "xy")
|
||||
assume (..)
|
||||
(..)
|
||||
lines in ".."
|
||||
one
|
||||
two
|
||||
..== ["one", "two"]
|
||||
|
||||
parse [アクション %spec %body] as (action %spec %body)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
%こんにちは = "こんにちは"
|
||||
アクション [% と言う] "\(%)世界"
|
||||
assume ((%こんにちは と言う) == "こんにちは世界") or barf ".."
|
||||
Unicode doesn't work
|
||||
|
||||
%s = "one two\\nthreefour"
|
||||
assume (%s == "one two\\nthreefour") or barf ".."
|
||||
%s = \(quote %s), not \(quote "one two\\nthreefour")
|
||||
|
||||
%s = "list:\[1, 2, 3]"
|
||||
assume (%s == "list:[1, 2, 3]")
|
||||
assume ("foo = \(1 + 2)!" == "foo = 3!")
|
||||
assume (..)
|
||||
".."
|
||||
one
|
||||
two
|
||||
..== ".."
|
||||
one
|
||||
two
|
||||
|
||||
assume ("nogap" == "nogap")
|
||||
|
||||
#comment
|
||||
#
|
||||
block comment
|
||||
|
||||
say "Text test passed."
|
Loading…
Reference in New Issue
Block a user