sendmail: fix missing empty line between header and body
[nit.git] / tests / utf_noindex_test.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # This file is free software, which comes along with NIT. This software is
4 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
5 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
6 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
7 # is kept unaltered, and a notification of the changes is added.
8 # You are allowed to redistribute it and sell it, alone or is a part of
9 # another product.
10
11 import standard
12 intrude import string_experimentations::utf8_noindex
13
14 var s = "aàハ𐍆".as(FlatString)
15 assert s.char_at(0).code_point == 97
16 assert s.char_at(1).code_point == 224
17 assert s.char_at(2).code_point == 12495
18 assert s.char_at(3).code_point == 66374
19
20 var str = "ハaロЖー𐍃aδΈ–η•Œ α“€ . α“‚ A,𐍆 aζ—₯本Aθͺžaです".as(FlatString)
21
22 print str.length
23 print str
24
25 for i in [0 .. str.length[ do
26 str.char_at(i).output
27 end
28
29 '\n'.output
30
31 var ss = str.reversed.as(FlatString)
32
33 for i in [0 .. ss.length[ do ss.char_at(i).output
34
35 '\n'.output
36
37 var x = str.substring(4,4).as(FlatString)
38
39 for i in [0 .. x.length[ do x.char_at(i).output
40
41 '\n'.output
42
43 var xx = x.reversed.as(FlatString)
44
45 for i in [0 .. xx.length[ do xx.char_at(i).output
46
47 '\n'.output
48
49 assert str * 2 == str + str
50
51 assert x * 2 == x + x
52
53 print str.to_upper
54
55 print str.to_lower
56
57 var buf = new FlatBuffer.from(str)
58
59 buf.append str
60
61 var bf = new FlatBuffer.from(str)
62
63 bf.times(2)
64
65 assert bf == buf
66
67 var bf2 = new FlatBuffer.from(str)
68
69 bf2.char_at(0) = str.char_at(1)
70 bf2.char_at(1) = str.char_at(0)
71
72 for i in [0 .. bf2.length[ do bf2.char_at(i).output
73
74 '\n'.output
75
76 bf2.lower
77
78 for i in [0 .. bf2.length[ do bf2.char_at(i).output
79
80 '\n'.output
81
82 bf2.upper
83
84 for i in [0 .. bf2.length[ do bf2.char_at(i).output
85
86 '\n'.output
87
88 bf2.reverse
89
90 for i in [0 .. bf2.length[ do bf2.char_at(i).output
91
92 '\n'.output