RegressionTests__PTYTest.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 31 May 2017 10:16:42 +0100
branchjv
changeset 1605 5ff1befbd463
parent 1500 d406a10b2965
child 1974 f2eaf05205d6
permissions -rw-r--r--
Added tests for (UNIX) TTY / PTY attribute support.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
     1
"{ Package: 'stx:goodies/regression' }"
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
TestCase subclass:#PTYTest
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
1605
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
     8
	poolDictionaries:'TTYConstants'
1081
bf79870b40e9 category change
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
     9
	category:'tests-Regression-Streams'
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
1605
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    13
!PTYTest methodsFor:'running'!
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    14
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    15
setUp
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    16
    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
    17
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    18
    "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
    19
! !
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    20
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!PTYTest methodsFor:'tests'!
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
1605
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    23
testEOLMode01
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    24
    |ptyPair master slave data |
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    25
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    26
    ptyPair := NonPositionableExternalStream makePTYPair.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    27
    master := ptyPair at:1.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    28
    slave := ptyPair at:2.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    29
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    30
    master nextPutLine:'1234'.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    31
    master nextPutLine:'ABCD'.  
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    32
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    33
    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
    34
    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
    35
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    36
    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
    37
    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
    38
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    39
    master close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    40
    slave close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    41
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    42
    "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
    43
    "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
    44
!
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
testEOLMode02
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    47
    "
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    48
    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
    49
    "
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 attrs |
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
    attrs := master getTTYAttributes.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    57
    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
    58
    master setTTYAttributes: attrs.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    59
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    60
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    61
    master nextPutLine:'1234'.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    62
    master nextPutLine:'ABCD'.  
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    63
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    64
    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
    65
    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
    66
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    67
    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
    68
    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
    69
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    70
    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
    71
    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
    72
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    73
    master close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    74
    slave close.
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
    "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
    77
    "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
    78
    "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
    79
!
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    80
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    81
testEchoOff
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    82
    |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
    83
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    84
    ptyPair := NonPositionableExternalStream makePTYPair.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    85
    master := ptyPair at:1.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    86
    slave := ptyPair at:2.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    87
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    88
    attrs := master getTTYAttributes.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    89
    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
    90
    master setTTYAttributes: attrs.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    91
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    92
    master nextPutLine:'1234567890'.
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  nextLine) = '1234567890'.      
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 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
    95
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    96
    attrs := master getTTYAttributes.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    97
    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
    98
    master setTTYAttributes: attrs.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
    99
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   100
    master nextPutLine:'1234567890'.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   101
    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
   102
    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
   103
    
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   104
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
    master close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   108
    slave close.
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
    "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
   111
    "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
   112
    "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
   113
!
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   114
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   115
testGetSetAttributes
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   116
    |ptyPair master slave 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
    ptyPair := NonPositionableExternalStream makePTYPair.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   119
    master := ptyPair at:1.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   120
    slave := ptyPair at:2.
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
    master setTTYAttributes: attrs.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   124
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   125
    attrs := slave getTTYAttributes.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   126
    slave setTTYAttributes: attrs. 
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   127
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   128
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   129
    master close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   130
    slave close.
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
    "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
   133
    "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
   134
!
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
testIsTTY
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   137
    |ptyPair master slave|
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   138
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   139
    ptyPair := NonPositionableExternalStream makePTYPair.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   140
    master := ptyPair at:1.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   141
    slave := ptyPair at:2.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   142
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   143
    self assert: master isTTY.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   144
    self assert: slave isTTY.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   145
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   146
    master close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   147
    slave close.
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   148
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   149
    "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
   150
!
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   151
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
testPTY1
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    |ptyPair master slave|
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
674
c84e667f52cb variable renamed in:
Stefan Vogel <sv@exept.de>
parents: 183
diff changeset
   155
    ptyPair := NonPositionableExternalStream makePTYPair.
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    master := ptyPair at:1.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    slave := ptyPair at:2.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    master nextPutLine:'1234567890'.
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   160
    '1234567890' do:[:ch |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   161
	self assert:(slave next = ch).
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   162
    ].
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   163
    self assert:(slave next = Character linefeed).
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   164
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   165
    master close.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   166
    slave close.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   167
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   168
    "
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   169
     self new testPTY1
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   170
    "
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   171
!
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   172
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   173
testPTY2
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   174
    |ptyPair master slave|
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   175
674
c84e667f52cb variable renamed in:
Stefan Vogel <sv@exept.de>
parents: 183
diff changeset
   176
    ptyPair := NonPositionableExternalStream makePTYPair.
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   177
    master := ptyPair at:1.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   178
    slave := ptyPair at:2.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   179
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   180
    master nextPutLine:'1234567890'.
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    self assert:(slave nextLine = '1234567890').
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    slave nextPutLine:'1234567890'.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    self assert:(master nextLine = '1234567890').
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    master close.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
    slave close.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   190
     self new testPTY2
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
! !
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
!PTYTest class methodsFor:'documentation'!
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
version
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    ^ '$Header$'
1605
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   198
!
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   199
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   200
version_HG
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   201
5ff1befbd463 Added tests for (UNIX) TTY / PTY attribute support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1500
diff changeset
   202
    ^ '$Changeset: <not expanded> $'
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
! !
1081
bf79870b40e9 category change
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
   204