author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 02 Jul 2018 08:46:03 +0200 | |
changeset 1073 | c591c75fe5a8 |
parent 1072 | a44c741ee5ef |
permissions | -rw-r--r-- |
829
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
1 |
" |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
2 |
A custom code generation and refactoring support for Smalltalk/X |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
3 |
Copyright (C) 2013-2015 Jakub Nesveda |
1072 | 4 |
Copyright (C) 2015 Jan Vrany |
829
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
5 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
6 |
This library is free software; you can redistribute it and/or |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
7 |
modify it under the terms of the GNU Lesser General Public |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
8 |
License as published by the Free Software Foundation; either |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
9 |
version 2.1 of the License. |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
10 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
11 |
This library is distributed in the hope that it will be useful, |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
14 |
Lesser General Public License for more details. |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
15 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
16 |
You should have received a copy of the GNU Lesser General Public |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
17 |
License along with this library; if not, write to the Free Software |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
18 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
19 |
" |
833
297eb38e4eee
Package jn:refactoring_custom renamed to stx:goodies/smallsense/refactoring_custom
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
830
diff
changeset
|
20 |
"{ Package: 'stx:goodies/smallsense/refactoring_custom' }" |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
21 |
|
830
1a88f5e65fe2
Classes moved to namespace SmallSense
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
829
diff
changeset
|
22 |
"{ NameSpace: SmallSense }" |
803
95cdac772759
Fixed failing tests caused by new STX release
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
734
diff
changeset
|
23 |
|
634
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
606
diff
changeset
|
24 |
CustomCodeGeneratorOrRefactoringTestCase subclass:#CustomCodeGeneratorTests |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
25 |
instanceVariableNames:'' |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
26 |
classVariableNames:'' |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
27 |
poolDictionaries:'' |
734
f8b10fc1ab0e
update TestCase categories with respect to their tested subjects ( classes )
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
690
diff
changeset
|
28 |
category:'Interface-Refactoring-Custom-Generators-Tests' |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
29 |
! |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
30 |
|
829
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
31 |
!CustomCodeGeneratorTests class methodsFor:'documentation'! |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
32 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
33 |
copyright |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
34 |
" |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
35 |
A custom code generation and refactoring support for Smalltalk/X |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
36 |
Copyright (C) 2013-2015 Jakub Nesveda |
1072 | 37 |
Copyright (C) 2015 Jan Vrany |
829
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
38 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
39 |
This library is free software; you can redistribute it and/or |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
40 |
modify it under the terms of the GNU Lesser General Public |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
41 |
License as published by the Free Software Foundation; either |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
42 |
version 2.1 of the License. |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
43 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
44 |
This library is distributed in the hope that it will be useful, |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
45 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
46 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
47 |
Lesser General Public License for more details. |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
48 |
|
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
49 |
You should have received a copy of the GNU Lesser General Public |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
50 |
License along with this library; if not, write to the Free Software |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
51 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
52 |
" |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
53 |
! ! |
59bfd92fcef0
Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
803
diff
changeset
|
54 |
|
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
55 |
!CustomCodeGeneratorTests methodsFor:'accessing'! |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
56 |
|
634
d77d9a7561be
move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
606
diff
changeset
|
57 |
generatorOrRefactoring |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
58 |
^ CustomCodeGenerator new |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
59 |
! ! |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
60 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
61 |
!CustomCodeGeneratorTests methodsFor:'tests'! |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
62 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
63 |
test_execute_sub_generator_classes |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
64 |
| subGeneratorClass_01 subGeneratorClass_02 expectedSource_01 expectedSource_02 | |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
65 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
66 |
"/ setup context |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
67 |
self classWithInstanceVariable. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
68 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
69 |
subGeneratorClass_01 := mock mockClassOf: CustomCodeGenerator. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
70 |
subGeneratorClass_02 := mock mockClassOf: CustomCodeGenerator. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
71 |
|
687
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
72 |
subGeneratorClass_01 compileMockMethod: 'description ''01'' '. |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
73 |
subGeneratorClass_01 new compileMockMethod: 'buildInContext: aCustomContext |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
74 |
|
687
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
75 |
aCustomContext selectedClasses do: [ :class | |
688
6bd18ba5e56c
completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
687
diff
changeset
|
76 |
model createMethod |
687
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
77 |
class: class; |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
78 |
source: ''selector_01 ^ 1''; |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
79 |
compile. |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
80 |
]'. |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
81 |
|
687
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
82 |
subGeneratorClass_02 compileMockMethod: 'description ''02'' '. |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
83 |
subGeneratorClass_02 new compileMockMethod: 'buildInContext: aCustomContext |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
84 |
|
687
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
85 |
aCustomContext selectedClasses do: [ :class | |
688
6bd18ba5e56c
completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
687
diff
changeset
|
86 |
model createMethod |
687
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
87 |
class: class; |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
88 |
source: ''selector_02 ^ 2''; |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
89 |
compile. |
2cd68852d81e
work in progress - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
634
diff
changeset
|
90 |
]'. |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
91 |
|
690
b87820270ed6
rename executeSubGeneratorClasses:inContext: to executeSubGeneratorOrRefactoringClasses:inContext:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
688
diff
changeset
|
92 |
generatorOrRefactoring |
b87820270ed6
rename executeSubGeneratorClasses:inContext: to executeSubGeneratorOrRefactoringClasses:inContext:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
688
diff
changeset
|
93 |
executeSubGeneratorOrRefactoringClasses:(Array with:subGeneratorClass_01 |
b87820270ed6
rename executeSubGeneratorClasses:inContext: to executeSubGeneratorOrRefactoringClasses:inContext:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
688
diff
changeset
|
94 |
with:subGeneratorClass_02) |
b87820270ed6
rename executeSubGeneratorClasses:inContext: to executeSubGeneratorOrRefactoringClasses:inContext:
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
688
diff
changeset
|
95 |
inContext:context. |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
96 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
97 |
expectedSource_01 := 'selector_01 |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
98 |
^ 1'. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
99 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
100 |
expectedSource_02 := 'selector_02 |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
101 |
^ 2'. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
102 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
103 |
self assertMethodSource: expectedSource_01 atSelector: #selector_01. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
104 |
self assertMethodSource: expectedSource_02 atSelector: #selector_02. |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
105 |
|
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
106 |
"Created: / 10-07-2014 / 12:11:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
688
6bd18ba5e56c
completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
687
diff
changeset
|
107 |
"Modified: / 10-10-2014 / 16:06:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>" |
606
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
108 |
! ! |
492cbd7bfe4b
add method to simplify execution of composed code generators
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff
changeset
|
109 |