Skip to content

Commit 0da354d

Browse files
committed
Add some torture tests for Unicode support
These are a set of specially-crafted text files designed to exercise most of the corner cases in the Unicode support code, particularly FullUnicodeLine.setChar()'s support for overwriting screen columns with changes in sequence lengths and display widths. For best (worst?) results, use the tests in vttest mode; the lines of exactly 80 columns will be more likely to uncover bugs that way.
1 parent c903ed9 commit 0da354d

File tree

10 files changed

+257
-0
lines changed

10 files changed

+257
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Overwriting a letter with combining diacritic with a letter without in an
2+
80-column line:
3+
4+
xxxxxMu[combining diaeresis]nchenxxx[...] ESC [ 7 G u:
5+
xxxxxMünchenxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxu
6+
7+
Overwriting a letter without combining diacritic with a letter with combining diacritic in an 80-column line:
8+
9+
xxxxMunchenxxx[...] ESC [ 6 G u [combining diaeresis]:
10+
xxxxMunchenxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü

tests/wideChars/combining-chars.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
East Asian wide characters with combining diacritics:
2+
3+
中文 [combining low line]:
4+
中文̲
5+
6+
xxx中[combining low line]文:
7+
xxx中̲文
8+
9+
Overwriting an East Asian wide character with combining diacritic with an East
10+
Asian wide character without combining diacritic, in the middle of an 80-column
11+
line with mixed narrow and wide chars:
12+
13+
xxx[...]xxx中文[combining low line]xxx[...]xxx你好ESC [ 23 G 国:
14+
xxxxxxxxxxxxxxxxxxxx中文̲xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好国
15+
16+
xxx[...]xxx中文[combining low line]。xxx[...]xxx你好xESC [ 23 G 国:
17+
xxxxxxxxxxxxxxxxxxxx中文̲。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x国
18+
19+
Overwriting an East Asian wide character with another one with a combining
20+
diacritic, in the middle of an 80-column line with mixed narrow and wide chars:
21+
22+
xxx[...]xxx中文xxx[...]xxx你好ESC [ 23 G 国[combining low line]:
23+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好国̲
24+
25+
xxx[...]xxx中文。xxx[...]xxx你好xESC [ 23 G 国[combining low line]:
26+
xxxxxxxxxxxxxxxxxxxx中文。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x国̲
27+
28+
Overwriting a narrow character with an East Asian wide character with a
29+
combining diacritic, in the middle of an 80-column line with mixed narrow and
30+
wide chars:
31+
32+
xxx[...]xxx中文xxx[...]xxx你好xESC [ 25 G 。[combining low line]:
33+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x。̲
34+
35+
xxx[...]xxx中y文xxx[...]xxx你好ESC [ 23 G ,[combining low line]:
36+
xxxxxxxxxxxxxxxxxxxx中y文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好,̲
37+
38+
Overwriting a narrow character with a combining diacritic with an East Asian
39+
wide character, in the middle of an 80-column line with mixed narrow and
40+
widechars:
41+
42+
xxxxxxxxàxxx[...]xxx中文xxx[...]xxx你好xESC [ 9 G 中:
43+
xxxxxxxxàxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x中
44+
45+
xxxxxxxxàxxx[...]xxx中文xxx[...]xxx你好xESC [ 8 G 中:
46+
xxxxxxxxàxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x中
47+
48+
Overwriting an East Asian wide character with combining diacritic with a narrow
49+
character without combining diacritic, in the middle of an 80-column line with
50+
mixed narrow and wide chars:
51+
52+
xxx[...]xxx中文[combining low line]xxx[...]xxx你好ESC [ 23 G y:
53+
xxxxxxxxxxxxxxxxxxxx中文̲xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好y
54+
55+
xxx[...]xxx中文[combining low line]。xxx[...]xxx你好xESC [ 23 G y:
56+
xxxxxxxxxxxxxxxxxxxx中文̲。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好xy
57+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
A line taking 81 screen columns, with an East Asian wide character at column 79
2+
(should be truncated or wrapped on an 80-column terminal):
3+
4+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好

tests/wideChars/linkification.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
A link on a line with East Asian wide characters:
2+
中国国际航空公司 http://www.airchina.com/
3+
4+
A link on a long line with East Asian wide characters (the link should be
5+
wrapped across two lines on an 80-column terminal):
6+
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 中国国际航空公司 http://www.airchina.com/

tests/wideChars/overwriting1.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Overwriting an East Asian wide character with another one:
2+
3+
中国 ESC [ 2 D 文:
4+
中国文
5+
6+
xxx中文 ESC [ 2 D 国:
7+
xxx中文国
8+
9+
Overwriting an East Asian wide character with another one, in the middle of
10+
an 80-column line with mixed narrow and wide chars:
11+
12+
xxx[...]xxx中文xxx[...]xxx你好ESC [ 23 G 国:
13+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好国
14+
15+
xxx[...]xxx中文。xxx[...]xxx你好xESC [ 23 G 国:
16+
xxxxxxxxxxxxxxxxxxxx中文。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x国

tests/wideChars/overwriting2.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Inserting an East Asian wide character into the middle of another one:
2+
3+
中国 ESC [ D 文:
4+
中国文
5+
6+
xxx中文 ESC [ D 国:
7+
xxx中文国
8+
9+
Inserting an East Asian wide character into the middle of another one, in the
10+
middle of an 80-column line with mixed narrow and wide chars:
11+
12+
xxx[...]xxx中文xxx[...]xxx你好xESC [ 24 G 国:
13+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x国
14+
15+
xxx[...]xxx中文。xxx[...]xxx你好ESC [ 24 G 国:
16+
xxxxxxxxxxxxxxxxxxxx中文。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好国

tests/wideChars/overwriting3.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Overwriting an East Asian wide character with a narrow character:
2+
3+
中国 ESC [ 2 D x:
4+
中国x
5+
6+
xxx中文 ESC [ 2 D x:
7+
xxx中文x
8+
9+
Overwriting an East Asian wide character with a narrow character, in the middle
10+
of an 80-column line with mixed narrow and wide chars:
11+
12+
xxx[...]xxx中文xxx[...]xxx你好xESC [ 23 G y:
13+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好xy
14+
15+
xxx[...]xxx中文。xxx[...]xxx你好ESC [ 23 G y:
16+
xxxxxxxxxxxxxxxxxxxx中文。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好y

tests/wideChars/overwriting4.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Overwriting a narrow character with an East Asian wide character:
2+
3+
xxx ESC [ D 中:
4+
xxx中
5+
6+
xxx ESC [ 3 D 中:
7+
xxx中
8+
9+
Overwriting a narrow character with an East Asian wide character, in the middle
10+
of an 80-column line with mixed narrow and wide chars:
11+
12+
xxx[...]xxx中文xxx[...]xxx你好xESC [ 25 G 版:
13+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x版
14+
15+
xxx[...]xxx中文y。xxx[...]xxx你好ESC [ 25 G 版:
16+
xxxxxxxxxxxxxxxxxxxx中文y。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好版

tests/wideChars/overwriting5.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Inserting a narrow character into the middle of an East Asian wide character:
2+
3+
中国 ESC [ D x:
4+
中国x
5+
6+
xxx中文 ESC [ D x:
7+
xxx中文x
8+
9+
Inserting a narrow character into the middle of an East Asian wide character,
10+
in the middle of an 80-column line with mixed narrow and wide chars:
11+
12+
xxx[...]xxx中文xxx[...]xxx你好xESC [ 24 G y:
13+
xxxxxxxxxxxxxxxxxxxx中文xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好xy
14+
15+
xxx[...]xxx中文。xxx[...]xxx你好ESC [ 24 G y:
16+
xxxxxxxxxxxxxxxxxxxx中文。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好y

tests/wideChars/sip-chars.txt

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
East Asian wide characters in the Supplementary Ideographic Plane (thanks to
2+
http://www.i18nguy.com/unicode/supplementary-test.html):
3+
4+
𠜎𠜱𠝹𠱓𠱸
5+
6+
Mixed East Asian wide characters from the BMP and SIP:
7+
8+
中文:𠜎𠜱,你好,𠝹国。
9+
𠱸,中文:你好,𠝹国。
10+
11+
Narrow characters and mixed east Asian wide characters from the BMP and SIP, in
12+
an 80-column line:
13+
xxxxxxxxxx中文:𠜎𠜱,你好,xx𠝹国。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好xxxxxxxxxx
14+
xxxxxxxxxx𠱸,中文:你xx好,𠝹国。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx好
15+
16+
Overwriting an East Asian wide character from the SIP with a narrow character:
17+
18+
中文:𠜎 ESC [ 2 D x:
19+
中文:𠜎x
20+
21+
xxx中文:𠜎 ESC [ 2 D x:
22+
xxx中文:𠜎x
23+
24+
Overwriting an East Asian wide character from the SIP with a narrow character,
25+
in the middle of an 80-column line with mixed narrow and wide chars:
26+
27+
xxx[...]xxx中文:𠜎xxx[...]xxx你好xESC [ 27 G y:
28+
xxxxxxxxxxxxxxxxxxxx中文:𠜎xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好xy
29+
30+
xxx[...]xxx中文:𠜎。xxx[...]xxx你好ESC [ 27 G y:
31+
xxxxxxxxxxxxxxxxxxxx中文:𠜎。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好y
32+
33+
Overwriting an East Asian wide character from the SIP with an East Asian wide
34+
character from the BMP:
35+
36+
中文:𠜎 ESC [ 2 D 国:
37+
中文:𠜎国
38+
39+
xxx中文:𠜎 ESC [ 2 D 国:
40+
xxx中文:𠜎国
41+
42+
Overwriting an East Asian wide character from the SIP with an East Asian wide
43+
character from the BMP in the middle of an 80-column line with mixed narrow and
44+
wide chars:
45+
46+
xxx[...]xxx中文:𠜎xxx[...]xxx你好xESC [ 27 G 国:
47+
xxxxxxxxxxxxxxxxxxxx中文:𠜎xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x国
48+
49+
xxx[...]xxx中文:𠜎。xxx[...]xxx你好ESC [ 27 G 国:
50+
xxxxxxxxxxxxxxxxxxxx中文:𠜎。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好国
51+
52+
Overwriting an East Asian wide character from the BMP with an East Asian wide
53+
character from the SIP:
54+
55+
中文:国 ESC [ 2 D 𠜎:
56+
中文:国𠜎
57+
58+
xxx中文:国 ESC [ 2 D 𠜎:
59+
xxx中文:国𠜎
60+
61+
Overwriting an East Asian wide character from the BMP with an East Asian wide
62+
character from the SIP in the middle of an 80-column line with mixed narrow and
63+
wide chars:
64+
65+
xxx[...]xxx中文:国xxx[...]xxx你好xESC [ 27 G 𠜎:
66+
xxxxxxxxxxxxxxxxxxxx中文:国xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x𠜎
67+
68+
xxx[...]xxx中文:国。xxx[...]xxx你好ESC [ 27 G 𠜎:
69+
xxxxxxxxxxxxxxxxxxxx中文:国。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好𠜎
70+
71+
Inserting a narrow character into the middle of an East Asian wide character
72+
from the SIP in the middle of an 80-column line with mixed narrow and wide
73+
chars:
74+
75+
xxx[...]xxx中文:𠜎xxx[...]xxx你好xESC [ 28 G y:
76+
xxxxxxxxxxxxxxxxxxxx中文:𠜎xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好xy
77+
78+
xxx[...]xxx中文:𠜎。xxx[...]xxx你好ESC [ 28 G y:
79+
xxxxxxxxxxxxxxxxxxxx中文:𠜎。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好y
80+
81+
Inserting an East Asian wide character from the SIP into the middle of an East
82+
Asian wide character from the BMP in the middle of an 80-column line with mixed
83+
narrow and wide chars:
84+
85+
xxx[...]xxx中文:国xxx[...]xxx你好xESC [ 28 G 𠜎:
86+
xxxxxxxxxxxxxxxxxxxx中文:国xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x𠜎
87+
88+
xxx[...]xxx中文:国。xxx[...]xxx你好ESC [ 28 G 𠜎:
89+
xxxxxxxxxxxxxxxxxxxx中文:国。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好𠜎
90+
91+
Inserting an East Asian wide character from the BMP into the middle of an East
92+
Asian wide character from the SIP in the middle of an 80-column line with mixed
93+
narrow and wide chars:
94+
95+
xxx[...]xxx中文:𠜎xxx[...]xxx你好xESC [ 28 G 国:
96+
xxxxxxxxxxxxxxxxxxxx中文:𠜎xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好x国
97+
98+
xxx[...]xxx中文:𠜎。xxx[...]xxx你好ESC [ 28 G 国:
99+
xxxxxxxxxxxxxxxxxxxx中文:𠜎。xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx你好国
100+

0 commit comments

Comments
 (0)