aboutsummaryrefslogtreecommitdiff
path: root/tests/text.nom
blob: d6805607422c5b807e630b6c3f42e928ab6a7af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/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."