CodeGeneratorTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 19 Jul 2017 09:42:32 +0200
branchjv
changeset 17619 edb119820fcb
parent 15950 23be8cf85415
permissions -rw-r--r--
Issue #154: Set window style using `#beToolWindow` to indicate that the minirunner window is kind of support tool rather than some X11 specific code (which does not work on Windows of course) See https://swing.fit.cvut.cz/projects/stx-jv/ticket/154
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10046
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     2
 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     3
 Copyright (c) 2009-2010 eXept Software AG
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10046
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     5
 Permission is hereby granted, free of charge, to any person
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     6
 obtaining a copy of this software and associated documentation
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     7
 files (the 'Software'), to deal in the Software without
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     8
 restriction, including without limitation the rights to use,
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
     9
 copy, modify, merge, publish, distribute, sublicense, and/or sell
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    10
 copies of the Software, and to permit persons to whom the
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    11
 Software is furnished to do so, subject to the following
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    12
 conditions:
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    13
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    14
 The above copyright notice and this permission notice shall be
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    15
 included in all copies or substantial portions of the Software.
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    16
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    17
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    18
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    19
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    20
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    21
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    22
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    23
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    24
 OTHER DEALINGS IN THE SOFTWARE.
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
15950
23be8cf85415 Bugfix in merge tool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15566
diff changeset
    28
"{ NameSpace: Smalltalk }"
23be8cf85415 Bugfix in merge tool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 15566
diff changeset
    29
13802
5bce9a814951 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 10046
diff changeset
    30
TestCase subclass:#CodeGeneratorTests
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	instanceVariableNames:'cg'
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
	classVariableNames:''
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
	poolDictionaries:''
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	category:'Interface-Browsers'
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!CodeGeneratorTests class methodsFor:'documentation'!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
copyright
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
10046
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    41
 Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    42
 Copyright (c) 2009-2010 eXept Software AG
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    43
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    44
 Permission is hereby granted, free of charge, to any person
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    45
 obtaining a copy of this software and associated documentation
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    46
 files (the 'Software'), to deal in the Software without
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    47
 restriction, including without limitation the rights to use,
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    48
 copy, modify, merge, publish, distribute, sublicense, and/or sell
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    49
 copies of the Software, and to permit persons to whom the
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    50
 Software is furnished to do so, subject to the following
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    51
 conditions:
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
10046
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    53
 The above copyright notice and this permission notice shall be
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    54
 included in all copies or substantial portions of the Software.
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    55
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    56
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    57
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    58
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    59
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    60
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    61
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    62
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5ab125878ab0 copyright
Claus Gittinger <cg@exept.de>
parents: 10012
diff changeset
    63
 OTHER DEALINGS IN THE SOFTWARE.
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
! !
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
!CodeGeneratorTests methodsFor:'initialization & release'!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
setUp
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    cg := CodeGenerator new
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    "Created: / 07-07-2009 / 09:26:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
tearDown
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    | mocks |
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    mocks := Set new.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    self class selectorsDo:
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
        [:selector| 
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
        (selector startsWith: 'mock')
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
            ifTrue:[mocks add: selector]].
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    mocks do:
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
        [:selector|
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
        self class removeSelector: selector].
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    "Modified: / 07-07-2009 / 09:34:22 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
! !
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!CodeGeneratorTests methodsFor:'mocks - do not remove'!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
mmock_03
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    ^3
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    "Created: / 07-07-2009 / 19:21:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
mmock_03: x
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    ^x
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    "Created: / 07-07-2009 / 19:55:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
! !
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!CodeGeneratorTests methodsFor:'tests'!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
test_01
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    cg
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
        class: self class;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
        replace: '`@e' with: '1';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
        source: 'mock_01 ^ `@e';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
        compile.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    self assert: (self respondsTo: #mock_01).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
    self assert: (self mock_01 = 1).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    "Created: / 07-07-2009 / 09:29:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
test_02
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    cg
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
        class: self class;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
        replace: '`@selector' with: #mock_02;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
        source: '`@selector ^ 2';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
        compile.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    self assert: (self respondsTo: #mock_02).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    self assert: (self mock_02 = 2).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    "Created: / 07-07-2009 / 19:07:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
test_02b
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    cg
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
        class: self class;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
        replace: '`@selector:' with: #mock_02:;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
        source: '`@selector: arg ^ arg';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
        compile.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    self assert: (self respondsTo: #mock_02:).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    self assert: (self mock_02: 20) = 20.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    "Created: / 07-07-2009 / 19:54:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
test_03
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    cg
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
        class: self class;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
        replace: '`@selector' with: 'mmock_03';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
        source: 'mock_03 ^ self `@selector';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
        compile.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    self assert: (self respondsTo: #mock_03).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    self assert: (self mock_03 = 3).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    "Created: / 07-07-2009 / 19:22:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
test_03b
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    cg
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
        class: self class;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
        replace: '`@selector:' with: #mmock_03:;
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
        source: 'mock_03b ^ self `@selector: 30';
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
        compile.
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    self assert: (self respondsTo: #mock_03b).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    self assert: (self mock_03b = 30).
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    "Created: / 07-07-2009 / 19:54:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
14281
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   177
!
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   178
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   179
test_04a
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   180
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   181
    cg
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   182
        class: self class;
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   183
        source: '`@selector ^ 4';
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   184
        replace: '`@selector' with: #mock_04a;
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   185
        compile.
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   186
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   187
    self assert: (self respondsTo: #mock_04a).
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   188
    self assert: (self mock_04a = 4).
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   189
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   190
    "Created: / 24-04-2014 / 11:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   191
!
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   192
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   193
test_04b
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   194
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   195
    cg
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   196
        class: self class;
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   197
        source: '`@selpart1 anArg `@selpart2 anArg2 ^ anArg + anArg2';
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   198
        replace: '`@selpart1' with: #mock_04:;
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   199
        replace: '`@selpart2' with: #b:;
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   200
        compile.
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   201
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   202
    self assert: (self respondsTo: #mock_04:b:).
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   203
    self assert: ((self mock_04:123 b: 123) = (123+123)).
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   204
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   205
    "Created: / 24-04-2014 / 11:15:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   206
!
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   207
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   208
test_05
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   209
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   210
    cg
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   211
        class: self class;
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   212
        source: 'mock_05
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   213
                "comment"
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   214
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   215
                ^ 10';
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   216
        compile.
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   217
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   218
    self assert: (self respondsTo: #mock_05).
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   219
    self assert: (self perform: #mock_05) == 10.
14422
40f9ff83b8aa Fix to preserve comment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14281
diff changeset
   220
    self assert: ((self class >> #mock_05) source includesString: 'comment')
14281
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   221
7ef95511205a Added more tests...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13802
diff changeset
   222
    "Created: / 24-04-2014 / 11:28:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14422
40f9ff83b8aa Fix to preserve comment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14281
diff changeset
   223
    "Modified: / 24-05-2014 / 01:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
! !
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
!CodeGeneratorTests class methodsFor:'documentation'!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
version_CVS
14422
40f9ff83b8aa Fix to preserve comment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14281
diff changeset
   229
    ^ '$Header: /cvs/stx/stx/libtool/CodeGeneratorTests.st,v 1.5 2014-05-24 00:10:50 vrany Exp $'
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
!
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
version_SVN
14422
40f9ff83b8aa Fix to preserve comment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14281
diff changeset
   233
    ^ '$Id: CodeGeneratorTests.st,v 1.5 2014-05-24 00:10:50 vrany Exp $'
10012
b9d3ade2b5bc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
! !
13802
5bce9a814951 merged in jv's chenges
Claus Gittinger <cg@exept.de>
parents: 10046
diff changeset
   235