author | Jan Vrany <jan.vrany@labware.com> |
Mon, 08 Mar 2021 11:25:35 +0000 | |
branch | jv |
changeset 2594 | e5f39c0a5bd6 |
parent 1974 | f2eaf05205d6 |
permissions | -rwxr-xr-x |
1974 | 1 |
" |
2 |
COPYRIGHT (c) 2017 Jan Vrany |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1447 | 12 |
"{ Package: 'stx:goodies/regression' }" |
182 | 13 |
|
14 |
"{ NameSpace: RegressionTests }" |
|
15 |
||
16 |
TestCase subclass:#PTYTest |
|
17 |
instanceVariableNames:'' |
|
18 |
classVariableNames:'' |
|
1605
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
19 |
poolDictionaries:'TTYConstants' |
1081 | 20 |
category:'tests-Regression-Streams' |
182 | 21 |
! |
22 |
||
1974 | 23 |
!PTYTest class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2017 Jan Vrany |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
182 | 38 |
|
1605
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
39 |
!PTYTest methodsFor:'running'! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
40 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
41 |
setUp |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
42 |
self skipIf: OperatingSystem supportsTTYs not description: 'No TTY / PTY support' |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
43 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
44 |
"Created: / 01-06-2017 / 21:25:55 / jv" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
45 |
! ! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
46 |
|
182 | 47 |
!PTYTest methodsFor:'tests'! |
48 |
||
1605
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
49 |
testEOLMode01 |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
50 |
|ptyPair master slave data | |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
51 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
52 |
ptyPair := NonPositionableExternalStream makePTYPair. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
53 |
master := ptyPair at:1. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
54 |
slave := ptyPair at:2. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
55 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
56 |
master nextPutLine:'1234'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
57 |
master nextPutLine:'ABCD'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
58 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
59 |
self assert:(data := slave nextLine) = '1234'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
60 |
self assert:(data := master nextLine) = '1234'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
61 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
62 |
self assert:(data := slave nextLine) = 'ABCD'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
63 |
self assert:(data := master nextLine) = 'ABCD'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
64 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
65 |
master close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
66 |
slave close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
67 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
68 |
"Created: / 31-05-2017 / 09:52:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
69 |
"Modified (comment): / 31-05-2017 / 11:35:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
70 |
! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
71 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
72 |
testEOLMode02 |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
73 |
" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
74 |
Turn off CR-LF on PTY (i.e., make sure lines are NL only) |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
75 |
" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
76 |
|ptyPair master slave data attrs | |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
77 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
78 |
ptyPair := NonPositionableExternalStream makePTYPair. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
79 |
master := ptyPair at:1. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
80 |
slave := ptyPair at:2. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
81 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
82 |
attrs := master getTTYAttributes. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
83 |
attrs c_oflag: (attrs c_oflag bitClear: ONLCR). |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
84 |
master setTTYAttributes: attrs. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
85 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
86 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
87 |
master nextPutLine:'1234'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
88 |
master nextPutLine:'ABCD'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
89 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
90 |
self assert:(data := slave next:4) = '1234'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
91 |
self assert:(data := master next:4) = '1234'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
92 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
93 |
self assert: (data := slave next) == Character linefeed. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
94 |
self assert: (data := master next) == Character linefeed. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
95 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
96 |
self assert: (data := slave next: 4) = 'ABCD'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
97 |
self assert: (data := master next: 4) = 'ABCD'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
98 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
99 |
master close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
100 |
slave close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
101 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
102 |
"Created: / 31-05-2017 / 09:53:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
103 |
"Modified: / 31-05-2017 / 15:29:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
104 |
"Modified: / 01-06-2017 / 21:23:35 / jv" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
105 |
! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
106 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
107 |
testEchoOff |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
108 |
|ptyPair master slave attrs data | |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
109 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
110 |
ptyPair := NonPositionableExternalStream makePTYPair. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
111 |
master := ptyPair at:1. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
112 |
slave := ptyPair at:2. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
113 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
114 |
attrs := master getTTYAttributes. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
115 |
attrs c_lflag: attrs c_lflag | ECHO. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
116 |
master setTTYAttributes: attrs. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
117 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
118 |
master nextPutLine:'1234567890'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
119 |
self assert:(data := slave nextLine) = '1234567890'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
120 |
self assert:(data := master nextAvailable:10+1"CR"+1"NL") notEmpty. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
121 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
122 |
attrs := master getTTYAttributes. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
123 |
attrs c_lflag: (attrs c_lflag bitClear: ECHO). |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
124 |
master setTTYAttributes: attrs. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
125 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
126 |
master nextPutLine:'1234567890'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
127 |
self assert:(data := slave nextLine) = '1234567890'. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
128 |
self assert:(data := master nextAvailable: 11) isEmpty. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
129 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
130 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
131 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
132 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
133 |
master close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
134 |
slave close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
135 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
136 |
"Created: / 31-05-2017 / 07:41:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
137 |
"Modified: / 31-05-2017 / 08:46:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
138 |
"Modified: / 01-06-2017 / 21:23:55 / jv" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
139 |
! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
140 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
141 |
testGetSetAttributes |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
142 |
|ptyPair master slave attrs | |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
143 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
144 |
ptyPair := NonPositionableExternalStream makePTYPair. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
145 |
master := ptyPair at:1. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
146 |
slave := ptyPair at:2. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
147 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
148 |
attrs := master getTTYAttributes. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
149 |
master setTTYAttributes: attrs. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
150 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
151 |
attrs := slave getTTYAttributes. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
152 |
slave setTTYAttributes: attrs. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
153 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
154 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
155 |
master close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
156 |
slave close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
157 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
158 |
"Created: / 31-05-2017 / 07:39:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
159 |
"Modified: / 01-06-2017 / 21:24:09 / jv" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
160 |
! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
161 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
162 |
testIsTTY |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
163 |
|ptyPair master slave| |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
164 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
165 |
ptyPair := NonPositionableExternalStream makePTYPair. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
166 |
master := ptyPair at:1. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
167 |
slave := ptyPair at:2. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
168 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
169 |
self assert: master isTTY. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
170 |
self assert: slave isTTY. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
171 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
172 |
master close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
173 |
slave close. |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
174 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
175 |
"Created: / 31-05-2017 / 07:38:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
176 |
! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
177 |
|
182 | 178 |
testPTY1 |
179 |
|ptyPair master slave| |
|
180 |
||
674 | 181 |
ptyPair := NonPositionableExternalStream makePTYPair. |
182 | 182 |
master := ptyPair at:1. |
183 |
slave := ptyPair at:2. |
|
184 |
||
185 |
master nextPutLine:'1234567890'. |
|
183 | 186 |
'1234567890' do:[:ch | |
1447 | 187 |
self assert:(slave next = ch). |
183 | 188 |
]. |
189 |
self assert:(slave next = Character linefeed). |
|
190 |
||
191 |
master close. |
|
192 |
slave close. |
|
193 |
||
194 |
" |
|
195 |
self new testPTY1 |
|
196 |
" |
|
197 |
! |
|
198 |
||
199 |
testPTY2 |
|
200 |
|ptyPair master slave| |
|
201 |
||
674 | 202 |
ptyPair := NonPositionableExternalStream makePTYPair. |
183 | 203 |
master := ptyPair at:1. |
204 |
slave := ptyPair at:2. |
|
205 |
||
206 |
master nextPutLine:'1234567890'. |
|
182 | 207 |
self assert:(slave nextLine = '1234567890'). |
208 |
||
209 |
slave nextPutLine:'1234567890'. |
|
210 |
self assert:(master nextLine = '1234567890'). |
|
211 |
||
212 |
master close. |
|
213 |
slave close. |
|
214 |
||
215 |
" |
|
183 | 216 |
self new testPTY2 |
182 | 217 |
" |
218 |
! ! |
|
219 |
||
220 |
!PTYTest class methodsFor:'documentation'! |
|
221 |
||
222 |
version |
|
223 |
^ '$Header$' |
|
1605
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
224 |
! |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
225 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
226 |
version_HG |
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
227 |
|
5ff1befbd463
Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1500
diff
changeset
|
228 |
^ '$Changeset: <not expanded> $' |
182 | 229 |
! ! |
1081 | 230 |