Skip to content

Commit fc9c57f

Browse files
committed
Merge pull request #1096 from gracjan/pr-string-tests
Add string tests
2 parents f314243 + 702573b commit fc9c57f

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

tests/haskell-string-tests.el

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,18 @@
6767
(cons "\\n" "\n")
6868
(cons "\\'" "'")
6969
(cons "\\\"" "\"")
70-
(cons "\\SOH" "\x01")))
70+
(cons "\\SOH" "\x01")
71+
(cons "\\1114111" "\x10ffff")
72+
(cons "\\o4177777" "\x10ffff")
73+
(cons "\\x10ffff" "\x10ffff")
74+
(cons "\\^@" "\x00")
75+
(cons "\\^A" "\x01")
76+
(cons "\\^Z" "\x1A")
77+
(cons "\\^[" "\x1B")
78+
(cons "\\^\\" "\x1C")
79+
(cons "\\^]" "\x1D")
80+
(cons "\\^^" "\x1E")
81+
(cons "\\^_" "\x1F")))
7182
(should (string= (cdr cs)
7283
(haskell-string-literal-decode (concat "\"" (car cs) "\""))))
7384
(should (string= (cdr cs)
@@ -87,20 +98,20 @@
8798
"\x01" ;; '\SOH'
8899
"\x00df\x30" ;; '\223' '0'
89100
"'"
90-
"\'"
101+
"\'"
91102
"\""
92103
"\x0e&H"
93104
"\\"
94105
" \\ \\"
95106
"\\\\\""
96-
(string 40 945 8322 946 8323 8743 947 178 949 178 41)
97-
"x"
98-
"xy"
99-
"\\x123"
100-
"\\ \\x123"
101-
" "
102-
" "
103-
""))
107+
(string 40 945 8322 946 8323 8743 947 178 949 178 41)
108+
"x"
109+
"xy"
110+
"\\x123"
111+
"\\ \\x123"
112+
" "
113+
" "
114+
"")) ;
104115
(should (string= s0 (haskell-string-literal-decode (haskell-string-literal-encode s0))))
105116
(should (string= s0 (haskell-string-literal-decode (haskell-string-literal-encode s0 t) t))))
106117

@@ -112,3 +123,9 @@
112123
(s2 (haskell-string-literal-decode (haskell-string-literal-encode s0 t) t)))
113124
(should (string= s0 s1))
114125
(should (string= s0 s2))))))
126+
127+
(ert-deftest haskell-string-test-trim ()
128+
(should (equal "saf \t sdsaf"
129+
(haskell-string-trim "\r\n saf \t sdsaf \t\v\n \f")))
130+
(should (haskell-string-only-spaces-p "\r\n \t \t\v\n \f"))
131+
(should-not (haskell-string-only-spaces-p "\r\n \t x \t\v\n \f")))

0 commit comments

Comments
 (0)