RegressionTests__PTYTest.st
author Jan Vrany <jan.vrany@labware.com>
Mon, 08 Mar 2021 11:25:35 +0000
branchjv
changeset 2594 e5f39c0a5bd6
parent 1974 f2eaf05205d6
permissions -rwxr-xr-x
Improve UTF8 read/write tests in `ChangeSetTests`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1974
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     1
"
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     2
 COPYRIGHT (c) 2017 Jan Vrany
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     3
              All Rights Reserved
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     4
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     5
 This software is furnished under a license and may be used
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     6
 only in accordance with the terms of that license and with the
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
     9
 other person.  No title to or ownership of the software is
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    10
 hereby transferred.
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    11
"
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    12
"{ Package: 'stx:goodies/regression' }"
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ NameSpace: RegressionTests }"
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
TestCase subclass:#PTYTest
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    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
bf79870b40e9 category change
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
    20
	category:'tests-Regression-Streams'
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
1974
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    23
!PTYTest class methodsFor:'documentation'!
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    24
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    25
copyright
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    26
"
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    27
 COPYRIGHT (c) 2017 Jan Vrany
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    28
              All Rights Reserved
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    29
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    30
 This software is furnished under a license and may be used
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    31
 only in accordance with the terms of that license and with the
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    33
 be provided or otherwise made available to, or used by, any
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    34
 other person.  No title to or ownership of the software is
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    35
 hereby transferred.
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    36
"
f2eaf05205d6 Copyright updates
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1605
diff changeset
    37
! !
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    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
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
!PTYTest methodsFor:'tests'!
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    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
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
testPTY1
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    |ptyPair master slave|
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
674
c84e667f52cb variable renamed in:
Stefan Vogel <sv@exept.de>
parents: 183
diff changeset
   181
    ptyPair := NonPositionableExternalStream makePTYPair.
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    master := ptyPair at:1.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    slave := ptyPair at:2.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    master nextPutLine:'1234567890'.
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   186
    '1234567890' do:[:ch |
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   187
	self assert:(slave next = ch).
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   188
    ].
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   189
    self assert:(slave next = Character linefeed).
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   190
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   191
    master close.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   192
    slave close.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   193
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   194
    "
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   195
     self new testPTY1
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   196
    "
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   197
!
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   198
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   199
testPTY2
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   200
    |ptyPair master slave|
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   201
674
c84e667f52cb variable renamed in:
Stefan Vogel <sv@exept.de>
parents: 183
diff changeset
   202
    ptyPair := NonPositionableExternalStream makePTYPair.
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   203
    master := ptyPair at:1.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   204
    slave := ptyPair at:2.
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   205
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   206
    master nextPutLine:'1234567890'.
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    self assert:(slave nextLine = '1234567890').
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    slave nextPutLine:'1234567890'.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    self assert:(master nextLine = '1234567890').
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    master close.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    slave close.
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    "
183
429f11ad9c1e checkin from browser
penk
parents: 182
diff changeset
   216
     self new testPTY2
182
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    "
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
! !
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
!PTYTest class methodsFor:'documentation'!
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
version
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   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
ca050862dad0 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
! !
1081
bf79870b40e9 category change
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
   230