CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 26 Aug 2014 06:31:29 +0100
changeset 646 8338755e1088
parent 635 CustomCodeGeneratorTestCaseCodeGenerator.st@9edd6a278835
parent 636 CustomCodeGeneratorTestCaseCodeGenerator.st@a7f9fcc82017
child 656 a95284467938
permissions -rw-r--r--
Merged 9edd6a278835 and 38a38c28ddb1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     1
"{ Package: 'jn:refactoring_custom' }"
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     2
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
     3
CustomTestCaseCodeGenerator subclass:#CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     4
	instanceVariableNames:''
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     5
	classVariableNames:''
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     6
	poolDictionaries:''
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     7
	category:'Interface-Refactoring-Custom'
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     8
!
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
     9
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    10
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    11
!CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator class methodsFor:'accessing-presentation'!
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    12
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    13
description
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    14
    ^ 'Generate CodeGeneratorOrRefactoringTestCase subclass for selected classes (code generators/refactorings)'
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    15
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    16
    "Modified: / 23-08-2014 / 19:50:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    17
!
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    18
628
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    19
group
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    20
    "Returns a collection strings describing a group to which
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    21
     receiver belongs. A groups may be nested hence the array of
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    22
     strings. For example for subgroup 'Accessors' in group 'Generators'
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    23
     this method should return #('Generators' 'Accessors')."
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    24
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    25
    "/ By default return an empty array which means the item will appear
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    26
    "/ in top-level group.
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    27
    ^ #('Generators')
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    28
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    29
    "Created: / 22-08-2014 / 18:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    30
!
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    31
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    32
label
628
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    33
    ^ 'New Code Generator Testcase'
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    34
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    35
    "Modified: / 23-08-2014 / 19:50:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
628
6f639016753b Sort generators or refactorings by their group.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 592
diff changeset
    36
    "Modified: / 22-08-2014 / 18:50:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    37
! !
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    38
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    39
!CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator methodsFor:'executing'!
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    40
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    41
buildForClass: aClass testClass: aTestClass
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    42
    | source className |
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    43
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    44
    aTestClass superclassName: 'CustomCodeGeneratorOrRefactoringTestCase'.
592
25f7fff0dc9e fix class name retrieving in test case code generator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 591
diff changeset
    45
    className := aClass theNonMetaClass name.
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    46
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    47
    source := 'test_code_generated
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    48
    | expectedSource |
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    49
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    50
    expectedSource := ''instanceVariable
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    51
    ^ instanceVariable''.
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    52
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    53
    self executeGeneratorInContext: #classWithInstanceVariable.
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    54
    self assertMethodSource: expectedSource atSelector: #instanceVariable'.
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    55
634
d77d9a7561be move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 592
diff changeset
    56
    codeBuilder
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    57
        class: aTestClass;
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    58
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    59
        protocol: 'tests';
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    60
        source: source;
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    61
        createMethod;
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    62
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    63
        protocol: 'accessing';
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    64
        source: 'generatorOrRefactoring
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    65
    ^ `className new';
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    66
        replace: '`className' with: className asString;
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    67
        createMethod
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    68
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    69
    "Created: / 13-06-2014 / 09:27:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    70
    "Modified: / 23-08-2014 / 19:56:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
565
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    71
! !
e80ce770e237 CustomTestCaseCodeGenerator made as abstract to support multiple implementations of TestCase generation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    72
636
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    73
!CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator class methodsFor:'documentation'!
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    74
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    75
version_HG
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    76
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    77
    ^ '$Changeset: <not expanded> $'
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    78
! !
a7f9fcc82017 rename CustomCodeGeneratorTestCaseCodeGenerator to CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator and change its implementation to the new naming
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 634
diff changeset
    79