/[eiffelstudio]/trunk/eweasel/tests/unicode007/test.e
ViewVC logotype

Contents of /trunk/eweasel/tests/unicode007/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 100656 - (show annotations)
Wed Aug 23 13:58:27 2017 UTC (21 months ago) by alexk
File size: 3152 byte(s)
Added an example with Unicode white space characters to test that they are acceppted in the code as delimiters, and in manifest string and character literals as regular characters.
1 class TEST
2
3 create
4 make
5
6 feature
7
8 make
9 local
10 s: STRING_32
11 do
12 -- U+0009 character tabulation
13 -- U+000A line feed
14 -- U+000B line tabulation
15 -- U+000C form feed
16 -- U+000D carriage return
17 -- U+0020 space
18  -- U+00A0 no-break space
19  -- U+1680 ogham space mark
20  -- U+2000 en quad
21  -- U+2001 em quad
22  -- U+2002 en space
23  -- U+2003 em space
24  -- U+2004 three-per-em space
25  -- U+2005 four-per-em space
26  -- U+2006 six-per-em space
27  -- U+2007 figure space
28  -- U+2008 punctuation space
29  -- U+2009 thin space
30  -- U+200A hair space
31  -- U+202F narrow no-break space
32  -- U+205F medium mathematical space
33  -- U+3000 ideographic space
34 s := {STRING_32} "                 "
35 report_string (0x0009, s, 1)
36 report_string (0x000B, s, 2)
37 report_string (0x000C, s, 3)
38 report_string (0x0020, s, 4)
39 report_string (0x00A0, s, 5)
40 report_string (0x1680, s, 6)
41 report_string (0x2000, s, 7)
42 report_string (0x2001, s, 8)
43 report_string (0x2002, s, 9)
44 report_string (0x2003, s, 10)
45 report_string (0x2004, s, 11)
46 report_string (0x2005, s, 12)
47 report_string (0x2006, s, 13)
48 report_string (0x2007, s, 14)
49 report_string (0x2008, s, 15)
50 report_string (0x2009, s, 16)
51 report_string (0x200A, s, 17)
52 report_string (0x202F, s, 18)
53 report_string (0x205F, s, 19)
54 report_string (0x3000, s, 20)
55 report_character (0x0009, {CHARACTER_32} ' ', 1)
56 report_character (0x000B, {CHARACTER_32} ' ', 2)
57 report_character (0x000C, {CHARACTER_32} ' ', 3)
58 report_character (0x0020, {CHARACTER_32} ' ', 4)
59 report_character (0x00A0, {CHARACTER_32} ' ', 5)
60 report_character (0x1680, {CHARACTER_32} ' ', 6)
61 report_character (0x2000, {CHARACTER_32} ' ', 7)
62 report_character (0x2001, {CHARACTER_32} ' ', 8)
63 report_character (0x2002, {CHARACTER_32} ' ', 9)
64 report_character (0x2003, {CHARACTER_32} ' ', 10)
65 report_character (0x2004, {CHARACTER_32} ' ', 11)
66 report_character (0x2005, {CHARACTER_32} ' ', 12)
67 report_character (0x2006, {CHARACTER_32} ' ', 13)
68 report_character (0x2007, {CHARACTER_32} ' ', 14)
69 report_character (0x2008, {CHARACTER_32} ' ', 15)
70 report_character (0x2009, {CHARACTER_32} ' ', 16)
71 report_character (0x200A, {CHARACTER_32} ' ', 17)
72 report_character (0x202F, {CHARACTER_32} ' ', 18)
73 report_character (0x205F, {CHARACTER_32} ' ', 19)
74 report_character (0x3000, {CHARACTER_32} ' ', 20)
75 end
76
77 feature {NONE} -- Output
78
79 report_string (c: NATURAL_32; s: STRING_32; n: like {STRING_32}.lower)
80 -- Report if character with code `c` is at position `n` in string `s`.
81 do
82 io.put_string ("Test string #")
83 io.put_integer (n)
84 io.put_string (": ")
85 io.put_boolean (s [n].natural_32_code = c)
86 io.put_new_line
87 end
88
89 report_character (n: NATURAL_32; c: CHARACTER_32; t: INTEGER)
90 -- Report if character `c` has code `n` in test `t`.
91 do
92 io.put_string ("Test character #")
93 io.put_integer (t)
94 io.put_string (": ")
95 io.put_boolean (c.natural_32_code = n)
96 io.put_new_line
97 end
98
99 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23