Copy tests from GHC testsuite; part of #1161.
[packages/base.git] / tests / char001.hs
1 -- !!! Testing the behaviour of Char.lexLitChar a little..
2
3 -- [March 2003] We now allow \X and \O as escapes although the
4 -- spec only permits \x and \o. Seems more consistent.
5
6 module Main where
7
8 import Data.Char
9
10 lex' str = do
11 putStr ("lex " ++ str ++ " = ")
12 print (lex str)
13
14 hexes = do
15 lex' "'\\X00'"
16 lex' "'\\x0f2'"
17 lex' "'\\xf2'"
18 lex' "'\\xf2t'"
19 lex' "'\\X24'"
20 lex' "'\\x24b'"
21 lex' "'\\Xa4b'"
22 lex' "'\\xa4bg'"
23
24 octs = do
25 lex' "'\\o00'"
26 lex' "'\\o05'"
27 lex' "'\\o50'"
28 lex' "'\\o72'"
29 lex' "'\\o82'"
30 lex' "'\\O24'"
31 lex' "'\\O000024'"
32 lex' "'\\024b'"
33 lex' "'\\o14b'"
34 lex' "'\\0a4bg'"
35
36 main = do
37 hexes
38 octs
39
40
41
42
43