Skip to content

Commit 35bec05

Browse files
committed
Add module qualification to test predicates
Apply module qualifications to all imported predicates in test files to work around testing framework idiosyncracy where importing iso_ext causes other modules to become unavailable. Changes: - Qualify setup_call_cleanup with iso_ext: - Qualify process_create with process: - Qualify get_n_chars, get_char, peek_char, get_code, peek_code, and get_line_to_chars with charsio: - Qualify length with lists:
1 parent 42c3007 commit 35bec05

File tree

2 files changed

+84
-84
lines changed

2 files changed

+84
-84
lines changed

src/tests/get_n_chars.pl

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
test("timeout=0 equals get_n_chars/3", (
1111
atom_chars('/bin/echo', Echo),
1212
atom_chars('ABCDEFGHIJ', Content),
13-
setup_call_cleanup(
14-
process_create(Echo, [Content], [stdout(pipe(Out1))]),
15-
setup_call_cleanup(
16-
process_create(Echo, [Content], [stdout(pipe(Out2))]),
13+
iso_ext:setup_call_cleanup(
14+
process:process_create(Echo, [Content], [stdout(pipe(Out1))]),
15+
iso_ext:setup_call_cleanup(
16+
process:process_create(Echo, [Content], [stdout(pipe(Out2))]),
1717
(
18-
get_n_chars(Out1, 5, Chars1),
19-
get_n_chars(Out2, 5, Chars2, 0),
18+
charsio:get_n_chars(Out1, 5, Chars1),
19+
charsio:get_n_chars(Out2, 5, Chars2, 0),
2020
Chars1 = Chars2
2121
),
2222
close(Out2)
@@ -29,13 +29,13 @@
2929
test("variable N with timeout=0", (
3030
atom_chars('/bin/echo', Echo),
3131
atom_chars('Testing', Content),
32-
setup_call_cleanup(
33-
process_create(Echo, [Content], [stdout(pipe(Out1))]),
34-
setup_call_cleanup(
35-
process_create(Echo, [Content], [stdout(pipe(Out2))]),
32+
iso_ext:setup_call_cleanup(
33+
process:process_create(Echo, [Content], [stdout(pipe(Out1))]),
34+
iso_ext:setup_call_cleanup(
35+
process:process_create(Echo, [Content], [stdout(pipe(Out2))]),
3636
(
37-
get_n_chars(Out1, N1, Chars1),
38-
get_n_chars(Out2, N2, Chars2, 0),
37+
charsio:get_n_chars(Out1, N1, Chars1),
38+
charsio:get_n_chars(Out2, N2, Chars2, 0),
3939
N1 = N2,
4040
Chars1 = Chars2,
4141
N1 = 8,
@@ -51,13 +51,13 @@
5151
test("negative timeout equals no timeout", (
5252
atom_chars('/bin/echo', Echo),
5353
atom_chars('NegativeTest', Content),
54-
setup_call_cleanup(
55-
process_create(Echo, [Content], [stdout(pipe(Out1))]),
56-
setup_call_cleanup(
57-
process_create(Echo, [Content], [stdout(pipe(Out2))]),
54+
iso_ext:setup_call_cleanup(
55+
process:process_create(Echo, [Content], [stdout(pipe(Out1))]),
56+
iso_ext:setup_call_cleanup(
57+
process:process_create(Echo, [Content], [stdout(pipe(Out2))]),
5858
(
59-
get_n_chars(Out1, N1, Chars1),
60-
get_n_chars(Out2, N2, Chars2, -100),
59+
charsio:get_n_chars(Out1, N1, Chars1),
60+
charsio:get_n_chars(Out2, N2, Chars2, -100),
6161
N1 = N2,
6262
Chars1 = Chars2
6363
),
@@ -72,10 +72,10 @@
7272
atom_chars('/usr/bin/python3', Py),
7373
atom_chars('-c', C),
7474
atom_chars('import sys,time; [print(c,end="",flush=True) or time.sleep(1) for c in "ABCDEFGH"]', Cmd),
75-
setup_call_cleanup(
76-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
75+
iso_ext:setup_call_cleanup(
76+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
7777
(
78-
get_n_chars(Out, N, _Chars, 2500),
78+
charsio:get_n_chars(Out, N, _Chars, 2500),
7979
N >= 2,
8080
N =< 3
8181
),
@@ -87,10 +87,10 @@
8787
test("infinity atom means no timeout", (
8888
atom_chars('/bin/echo', Echo),
8989
atom_chars('InfinityTest', Content),
90-
setup_call_cleanup(
91-
process_create(Echo, [Content], [stdout(pipe(Out))]),
90+
iso_ext:setup_call_cleanup(
91+
process:process_create(Echo, [Content], [stdout(pipe(Out))]),
9292
(
93-
get_n_chars(Out, N, _Chars, infinity),
93+
charsio:get_n_chars(Out, N, _Chars, infinity),
9494
N > 0
9595
),
9696
close(Out)
@@ -102,11 +102,11 @@
102102
atom_chars('/usr/bin/python3', Py),
103103
atom_chars('-c', C),
104104
atom_chars('import sys,time; print("A",end="",flush=True); time.sleep(2); print("B",end="",flush=True)', Cmd),
105-
setup_call_cleanup(
106-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
105+
iso_ext:setup_call_cleanup(
106+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
107107
(
108-
get_n_chars(Out, N1, Chars1, 100),
109-
get_n_chars(Out, N2, Chars2, 3000),
108+
charsio:get_n_chars(Out, N1, Chars1, 100),
109+
charsio:get_n_chars(Out, N2, Chars2, 3000),
110110
N1 = 1,
111111
Chars1 = "A",
112112
N2 = 1,
@@ -121,11 +121,11 @@
121121
atom_chars('/usr/bin/python3', Py),
122122
atom_chars('-c', C),
123123
atom_chars('import sys,time; print("ABC",end="",flush=True); time.sleep(5); print("DEF",end="",flush=True)', Cmd),
124-
setup_call_cleanup(
125-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
124+
iso_ext:setup_call_cleanup(
125+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
126126
(
127-
get_n_chars(Out, N1, Chars1, 1000),
128-
get_n_chars(Out, N2, Chars2, 6000),
127+
charsio:get_n_chars(Out, N1, Chars1, 1000),
128+
charsio:get_n_chars(Out, N2, Chars2, 6000),
129129
N1 = 3,
130130
Chars1 = "ABC",
131131
N2 = 3,
@@ -139,12 +139,12 @@
139139
test("multiple reads with timeout=0", (
140140
atom_chars('/bin/echo', Echo),
141141
atom_chars('ABCDEFGHIJKLMNOP', Content),
142-
setup_call_cleanup(
143-
process_create(Echo, [Content], [stdout(pipe(Out))]),
142+
iso_ext:setup_call_cleanup(
143+
process:process_create(Echo, [Content], [stdout(pipe(Out))]),
144144
(
145-
get_n_chars(Out, 4, Chars1, 0),
146-
get_n_chars(Out, 4, Chars2, 0),
147-
get_n_chars(Out, 4, Chars3, 0),
145+
charsio:get_n_chars(Out, 4, Chars1, 0),
146+
charsio:get_n_chars(Out, 4, Chars2, 0),
147+
charsio:get_n_chars(Out, 4, Chars3, 0),
148148
Chars1 = "ABCD",
149149
Chars2 = "EFGH",
150150
Chars3 = "IJKL"
@@ -157,10 +157,10 @@
157157
test("read more than available with timeout=0", (
158158
atom_chars('/bin/echo', Echo),
159159
atom_chars('Short', Content),
160-
setup_call_cleanup(
161-
process_create(Echo, [Content], [stdout(pipe(Out))]),
160+
iso_ext:setup_call_cleanup(
161+
process:process_create(Echo, [Content], [stdout(pipe(Out))]),
162162
(
163-
get_n_chars(Out, N, _Chars, 0),
163+
charsio:get_n_chars(Out, N, _Chars, 0),
164164
N >= 5,
165165
N =< 7
166166
),
@@ -173,11 +173,11 @@
173173
atom_chars('/usr/bin/python3', Py),
174174
atom_chars('-c', C),
175175
atom_chars('import sys,time; [print(c,end="",flush=True) or time.sleep(0.5) for c in "ABCD"]', Cmd),
176-
setup_call_cleanup(
177-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
176+
iso_ext:setup_call_cleanup(
177+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
178178
(
179-
get_n_chars(Out, N, Chars, 1300),
180-
length(Chars, ActualLength),
179+
charsio:get_n_chars(Out, N, Chars, 1300),
180+
lists:length(Chars, ActualLength),
181181
N = ActualLength
182182
),
183183
close(Out)
@@ -191,13 +191,13 @@
191191
atom_chars('-c', C),
192192
% Send 💜 (F0 9F 92 9C) one byte at a time with delays
193193
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.1); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9c\"); sys.stdout.buffer.flush(); time.sleep(0.1); sys.stdout.buffer.write(b\"AB\"); sys.stdout.buffer.flush()', Cmd),
194-
setup_call_cleanup(
195-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
194+
iso_ext:setup_call_cleanup(
195+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
196196
(
197197
% First read: timeout after first byte (incomplete UTF-8)
198-
get_n_chars(Out, N1, _Chars1, 50),
198+
charsio:get_n_chars(Out, N1, _Chars1, 50),
199199
% Second read: should complete the emoji and get more
200-
get_n_chars(Out, N2, _Chars2, 500),
200+
charsio:get_n_chars(Out, N2, _Chars2, 500),
201201
% Verify lossless property: total should be 3 chars (💜 + A + B)
202202
TotalChars is N1 + N2,
203203
TotalChars = 3

src/tests/incomplete_utf8.pl

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
atom_chars('python3', Py),
1010
atom_chars('-c', C),
1111
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9cAB\"); sys.stdout.buffer.flush()', Cmd),
12-
setup_call_cleanup(
13-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
12+
iso_ext:setup_call_cleanup(
13+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
1414
(
15-
get_n_chars(Out, _, Chars1, 100),
15+
charsio:get_n_chars(Out, _, Chars1, 100),
1616
Chars1 == [],
17-
get_char(Out, C1),
17+
charsio:get_char(Out, C1),
1818
C1 == '💜'
1919
),
2020
close(Out)
@@ -25,14 +25,14 @@
2525
atom_chars('python3', Py),
2626
atom_chars('-c', C),
2727
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9cAB\"); sys.stdout.buffer.flush()', Cmd),
28-
setup_call_cleanup(
29-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
28+
iso_ext:setup_call_cleanup(
29+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
3030
(
31-
get_n_chars(Out, _, Chars1, 100),
31+
charsio:get_n_chars(Out, _, Chars1, 100),
3232
Chars1 == [],
33-
peek_char(Out, C1),
33+
charsio:peek_char(Out, C1),
3434
C1 == '💜',
35-
get_char(Out, C2),
35+
charsio:get_char(Out, C2),
3636
C2 == '💜'
3737
),
3838
close(Out)
@@ -43,12 +43,12 @@
4343
atom_chars('python3', Py),
4444
atom_chars('-c', C),
4545
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9cAB\"); sys.stdout.buffer.flush()', Cmd),
46-
setup_call_cleanup(
47-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
46+
iso_ext:setup_call_cleanup(
47+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
4848
(
49-
get_n_chars(Out, _, Chars1, 100),
49+
charsio:get_n_chars(Out, _, Chars1, 100),
5050
Chars1 == [],
51-
get_code(Out, Code),
51+
charsio:get_code(Out, Code),
5252
Code =:= 128156
5353
),
5454
close(Out)
@@ -59,14 +59,14 @@
5959
atom_chars('python3', Py),
6060
atom_chars('-c', C),
6161
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9cAB\"); sys.stdout.buffer.flush()', Cmd),
62-
setup_call_cleanup(
63-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
62+
iso_ext:setup_call_cleanup(
63+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
6464
(
65-
get_n_chars(Out, _, Chars1, 100),
65+
charsio:get_n_chars(Out, _, Chars1, 100),
6666
Chars1 == [],
67-
peek_code(Out, Code1),
67+
charsio:peek_code(Out, Code1),
6868
Code1 =:= 128156,
69-
get_code(Out, Code2),
69+
charsio:get_code(Out, Code2),
7070
Code2 =:= 128156
7171
),
7272
close(Out)
@@ -77,12 +77,12 @@
7777
atom_chars('python3', Py),
7878
atom_chars('-c', C),
7979
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9cAB\"); sys.stdout.buffer.flush()', Cmd),
80-
setup_call_cleanup(
81-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
80+
iso_ext:setup_call_cleanup(
81+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
8282
(
83-
get_n_chars(Out, _, Chars1, 100),
83+
charsio:get_n_chars(Out, _, Chars1, 100),
8484
Chars1 == [],
85-
get_n_chars(Out, 2, Chars2),
85+
charsio:get_n_chars(Out, 2, Chars2),
8686
Chars2 == "💜A"
8787
),
8888
close(Out)
@@ -93,12 +93,12 @@
9393
atom_chars('python3', Py),
9494
atom_chars('-c', C),
9595
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9c foo(bar).\"); sys.stdout.buffer.flush()', Cmd),
96-
setup_call_cleanup(
97-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
96+
iso_ext:setup_call_cleanup(
97+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
9898
(
99-
get_n_chars(Out, _, Chars1, 100),
99+
charsio:get_n_chars(Out, _, Chars1, 100),
100100
Chars1 == [],
101-
get_char(Out, Emoji),
101+
charsio:get_char(Out, Emoji),
102102
Emoji == '💜',
103103
read_term(Out, Term, []),
104104
Term == foo(bar)
@@ -111,12 +111,12 @@
111111
atom_chars('python3', Py),
112112
atom_chars('-c', C),
113113
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9ctest\\n\"); sys.stdout.buffer.flush()', Cmd),
114-
setup_call_cleanup(
115-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
114+
iso_ext:setup_call_cleanup(
115+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
116116
(
117-
get_n_chars(Out, _, Chars1, 100),
117+
charsio:get_n_chars(Out, _, Chars1, 100),
118118
Chars1 == [],
119-
get_line_to_chars(Out, Line, []),
119+
charsio:get_line_to_chars(Out, Line, []),
120120
Line == "💜test\n"
121121
),
122122
close(Out)
@@ -127,16 +127,16 @@
127127
atom_chars('python3', Py),
128128
atom_chars('-c', C),
129129
atom_chars('import sys,time; sys.stdout.buffer.write(b\"\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x92\\x9c\\xf0\"); sys.stdout.buffer.flush(); time.sleep(0.5); sys.stdout.buffer.write(b\"\\x9f\\x98\\x8a\"); sys.stdout.buffer.flush()', Cmd),
130-
setup_call_cleanup(
131-
process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
130+
iso_ext:setup_call_cleanup(
131+
process:process_create(Py, [C, Cmd], [stdout(pipe(Out))]),
132132
(
133-
get_n_chars(Out, _, Chars1, 100),
133+
charsio:get_n_chars(Out, _, Chars1, 100),
134134
Chars1 == [],
135-
get_char(Out, C1),
135+
charsio:get_char(Out, C1),
136136
C1 == '💜',
137-
get_n_chars(Out, _, Chars2, 100),
137+
charsio:get_n_chars(Out, _, Chars2, 100),
138138
Chars2 == [],
139-
get_char(Out, C2),
139+
charsio:get_char(Out, C2),
140140
C2 == '😊'
141141
),
142142
close(Out)

0 commit comments

Comments
 (0)