refactoring_custom/SmallSense__CustomSimpleGetterMethodsCodeGeneratorTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 25 Oct 2017 23:42:41 +0100
changeset 1058 6d4bf422a7dd
parent 833 297eb38e4eee
child 1072 a44c741ee5ef
permissions -rw-r--r--
Fix subscript out of bounds error in Smalltalk inderences ...caused by missing size-check when analysing typed prefix.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
     4
Copyright (C) 2013-now  Jan Vrany
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' }"
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
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: 746
diff changeset
    23
634
d77d9a7561be move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 566
diff changeset
    24
CustomCodeGeneratorOrRefactoringTestCase subclass:#CustomSimpleGetterMethodsCodeGeneratorTests
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    25
	instanceVariableNames:''
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    26
	classVariableNames:''
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
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: 634
diff changeset
    28
	category:'Interface-Refactoring-Custom-Generators-Tests'
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    29
!
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
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
!CustomSimpleGetterMethodsCodeGeneratorTests 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
59bfd92fcef0 Test fixes (all test pass now)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 803
diff changeset
    37
Copyright (C) 2013-now  Jan Vrany
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
! !
746
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
    54
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    55
!CustomSimpleGetterMethodsCodeGeneratorTests methodsFor:'accessing'!
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    56
634
d77d9a7561be move refactoryBuilder and codeBuilder to CustomCodeGeneratorOrRefactoring
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 566
diff changeset
    57
generatorOrRefactoring
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    58
    ^ CustomSimpleGetterMethodsCodeGenerator new
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    59
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    60
    "Modified: / 29-05-2014 / 00:07:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    61
! !
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    62
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    63
!CustomSimpleGetterMethodsCodeGeneratorTests methodsFor:'tests'!
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    64
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    65
test_simple_getter_method_generated_with_comments
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    66
    | expectedSource |
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    67
566
29c2269d339a replace inst. variable generateCommentsForGetters with userPreferences call - more flexibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 563
diff changeset
    68
    userPreferences generateCommentsForGetters: true.
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    69
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    70
    expectedSource := 'instanceVariable
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    71
    "return the instance variable ''instanceVariable'' (automatically generated)"
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    72
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    73
    ^ instanceVariable'.
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    74
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    75
    self executeGeneratorInContext: #classWithInstanceVariable.
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    76
    self assertMethodSource: expectedSource atSelector: #instanceVariable
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    77
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    78
    "Created: / 31-05-2014 / 20:06:05 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
566
29c2269d339a replace inst. variable generateCommentsForGetters with userPreferences call - more flexibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 563
diff changeset
    79
    "Modified: / 14-06-2014 / 10:41:05 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    80
!
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    81
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    82
test_simple_getter_method_generated_without_comments
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    83
    | expectedSource |
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    84
566
29c2269d339a replace inst. variable generateCommentsForGetters with userPreferences call - more flexibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 563
diff changeset
    85
    userPreferences generateCommentsForGetters: false.
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    86
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    87
    expectedSource := 'instanceVariable
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    88
    ^ instanceVariable'.
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    89
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    90
    self executeGeneratorInContext: #classWithInstanceVariable.
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    91
    self assertMethodSource: expectedSource atSelector: #instanceVariable
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    92
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    93
    "Created: / 31-05-2014 / 20:05:55 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
566
29c2269d339a replace inst. variable generateCommentsForGetters with userPreferences call - more flexibility
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 563
diff changeset
    94
    "Modified: / 14-06-2014 / 10:41:19 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
556
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    95
! !
107e4a470e73 add CustomCodeGeneratorTestCase as superclass for CodeGenerators TestCases to make testing easier
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    96
746
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
    97
!CustomSimpleGetterMethodsCodeGeneratorTests class methodsFor:'documentation'!
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
    98
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
    99
version_HG
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
   100
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
   101
    ^ '$Changeset: <not expanded> $'
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
   102
! !
a25dc307d4e8 Make CustomContext>>selectedClasses always return a collection of RBClass...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 734
diff changeset
   103