refactoring_custom/SmallSense__CustomCodeSelectionToResourceTranslationTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 13 Nov 2017 22:26:12 -0300
changeset 1060 af3a048f9618
parent 833 297eb38e4eee
child 1072 a44c741ee5ef
permissions -rw-r--r--
Fixed xompletion of instance variables in inspector
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' }"
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
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: 777
diff changeset
    23
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    24
CustomCodeGeneratorOrRefactoringTestCase subclass:#CustomCodeSelectionToResourceTranslationTests
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    25
	instanceVariableNames:''
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    26
	classVariableNames:''
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
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: 726
diff changeset
    28
	category:'Interface-Refactoring-Custom-Refactorings-Tests'
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    29
!
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
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
!CustomCodeSelectionToResourceTranslationTests 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
! !
726
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
    54
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    55
!CustomCodeSelectionToResourceTranslationTests methodsFor:'accessing'!
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    56
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    57
generatorOrRefactoring
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    58
    ^ CustomCodeSelectionToResourceTranslation new
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    59
! !
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    60
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    61
!CustomCodeSelectionToResourceTranslationTests methodsFor:'tests'!
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
    62
698
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    63
test_available_in_code_view_perspective
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    64
    | perspective |
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    65
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    66
    perspective := CustomPerspective codeViewPerspective.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    67
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    68
    self assert: (generatorOrRefactoring class availableInPerspective:perspective).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    69
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    70
    "Created: / 15-10-2014 / 08:10:35 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    71
!
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    72
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    73
test_available_in_context_empty
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    74
    
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    75
    self deny: (generatorOrRefactoring class availableInContext: context).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    76
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    77
    "Modified: / 15-10-2014 / 09:32:27 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    78
!
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    79
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    80
test_available_in_context_empty_selected_codes
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    81
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    82
    context selectedCodes: (Array
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    83
        with: CustomSourceCodeSelection new  
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    84
    ).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    85
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    86
    self deny: (generatorOrRefactoring class availableInContext: context).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    87
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    88
    "Created: / 15-10-2014 / 09:37:41 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
726
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
    89
    "Modified: / 05-11-2014 / 22:53:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
698
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    90
!
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    91
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    92
test_available_in_context_with_selected_codes
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    93
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    94
    context selectedCodes: (Array
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    95
        with: (CustomSourceCodeSelection new
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    96
            selectedInterval: (1 to: 5);
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    97
            currentSourceCode: 'selector_05 ^ 5';
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    98
            yourself)
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
    99
    ).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   100
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   101
    self assert: (generatorOrRefactoring class availableInContext: context).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   102
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   103
    "Created: / 15-10-2014 / 09:41:44 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   104
!
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   105
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   106
test_code_selection_replaced_by_resource_translation_01
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   107
    | expectedSource originalSource codeSelection class |
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   108
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   109
    originalSource := 'selector
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   110
    self information: ''Translate this''.
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   111
    ^ self.'.
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   112
688
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 650
diff changeset
   113
    class := model createClassImmediate: 'DummyClassForTestCase01' instanceVariableNames: 'resources'.
6bd18ba5e56c completed - rewriting code generators to replace CustomSourceCodeBuilder, but RBClass, RBMetaclass, RBNamespace and CodeGenerator
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 650
diff changeset
   114
    model createMethodImmediate: class source: originalSource.
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   115
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   116
    codeSelection := CustomSourceCodeSelection new.
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   117
    codeSelection
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   118
        currentSourceCode: originalSource;
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   119
        selectedClass: class;
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   120
        selectedInterval: (32 to: 48);
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   121
        selectedMethod: (class compiledMethodAt: #selector);
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   122
        selectedSelector: #selector.
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   123
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   124
    context selectedCodes: (Array with: codeSelection).  
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   125
    generatorOrRefactoring executeInContext: context.  
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   126
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   127
    expectedSource := 'selector
777
8f212cf1bb45 Improvemens in CustomRefactoryBuilder - no complete reformatting of method source code, but only the replacement parts
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 734
diff changeset
   128
    self information: (resources string:''Translate this'').
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   129
    ^ self.'.
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   130
650
7514c13d6dd8 working refactoring CustomCodeSelectionToResourceTranslation - wraps code selection in code editor (codeView) to translation call, finished code selection search/replace API in CustomRefactoryBuilder
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 645
diff changeset
   131
    self assertMethodSource:expectedSource atSelector:#selector forClass:class
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   132
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   133
    "Created: / 23-08-2014 / 20:09:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
777
8f212cf1bb45 Improvemens in CustomRefactoryBuilder - no complete reformatting of method source code, but only the replacement parts
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 734
diff changeset
   134
    "Modified: / 10-12-2014 / 20:14:32 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
698
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   135
!
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   136
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   137
test_code_selection_replaced_by_resource_translation_02
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   138
    | expectedSource originalSource codeSelection class |
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   139
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   140
    originalSource := 'selector
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   141
    self information: self theInformation.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   142
    ^ self.'.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   143
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   144
    class := model createClassImmediate: 'DummyClassForTestCase01' instanceVariableNames: 'resources'.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   145
    model createMethodImmediate: class source: originalSource.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   146
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   147
    codeSelection := CustomSourceCodeSelection new.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   148
    codeSelection
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   149
        currentSourceCode: originalSource;
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   150
        selectedClass: class;
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   151
        selectedInterval: (32 to: 51);
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   152
        selectedMethod: (class compiledMethodAt: #selector);
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   153
        selectedSelector: #selector.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   154
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   155
    context selectedCodes: (Array with: codeSelection).  
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   156
    generatorOrRefactoring executeInContext: context.  
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   157
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   158
    expectedSource := 'selector
777
8f212cf1bb45 Improvemens in CustomRefactoryBuilder - no complete reformatting of method source code, but only the replacement parts
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 734
diff changeset
   159
    self information: (resources string:self theInformation).
698
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   160
    ^ self.'.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   161
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   162
    self assertMethodSource:expectedSource atSelector:#selector forClass:class
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   163
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   164
    "Created: / 15-10-2014 / 09:45:08 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
777
8f212cf1bb45 Improvemens in CustomRefactoryBuilder - no complete reformatting of method source code, but only the replacement parts
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 734
diff changeset
   165
    "Modified: / 10-12-2014 / 20:14:42 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
698
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   166
!
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   167
704
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   168
test_code_selection_replaced_by_resource_translation_with_keep_package
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   169
    | expectedSource originalSource codeSelection class method compiledMethod |
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   170
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   171
    originalSource := 'selector
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   172
    self information: self theInformation.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   173
    ^ self.'.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   174
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   175
    class := model createClassImmediate: 'DummyClassForTestCase01' instanceVariableNames: 'resources'.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   176
    method := model createMethodImmediate: class source: originalSource.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   177
    method package: #some_package.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   178
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   179
    codeSelection := CustomSourceCodeSelection new.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   180
    codeSelection
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   181
        currentSourceCode: originalSource;
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   182
        selectedClass: class;
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   183
        selectedInterval: (32 to: 51);
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   184
        selectedMethod: (class compiledMethodAt: #selector);
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   185
        selectedSelector: #selector.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   186
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   187
    context selectedCodes: (Array with: codeSelection).  
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   188
    generatorOrRefactoring executeInContext: context.  
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   189
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   190
    expectedSource := 'selector
777
8f212cf1bb45 Improvemens in CustomRefactoryBuilder - no complete reformatting of method source code, but only the replacement parts
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 734
diff changeset
   191
    self information: (resources string:self theInformation).
704
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   192
    ^ self.'.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   193
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   194
    self assertMethodSource:expectedSource atSelector:#selector forClass:class.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   195
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   196
    compiledMethod := class compiledMethodAt: #selector.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   197
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   198
    self assert: #some_package = (compiledMethod package).
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   199
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   200
    "Created: / 16-10-2014 / 21:46:23 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
777
8f212cf1bb45 Improvemens in CustomRefactoryBuilder - no complete reformatting of method source code, but only the replacement parts
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 734
diff changeset
   201
    "Modified: / 10-12-2014 / 20:14:50 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
704
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   202
!
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   203
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   204
test_code_selection_replaced_by_resource_translation_with_wrong_selection
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   205
    | expectedSource originalSource codeSelection class |
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   206
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   207
    originalSource := 'method: arg
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   208
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   209
    arg ifNil: [ 
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   210
        self warn: ''nil''.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   211
    ]
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   212
    ifNotNil: [ self information: ''info'' ]'.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   213
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   214
    class := model createClassImmediate: 'DummyClassForTestCase01' instanceVariableNames: 'resources'.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   215
    model createMethodImmediate: class source: originalSource.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   216
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   217
    codeSelection := CustomSourceCodeSelection new.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   218
    codeSelection
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   219
        currentSourceCode: originalSource;
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   220
        selectedClass: class;
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   221
        selectedInterval: (8 to: 10);
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   222
        selectedMethod: (class compiledMethodAt: #method:);
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   223
        selectedSelector: #selector.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   224
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   225
    context selectedCodes: (Array with: codeSelection).  
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   226
    generatorOrRefactoring executeInContext: context.  
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   227
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   228
    expectedSource := 'method: arg
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   229
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   230
    arg ifNil: [ 
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   231
        self warn: ''nil''.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   232
    ]
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   233
    ifNotNil: [ self information: ''info'' ]'.
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   234
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   235
    self assertMethodSource:expectedSource atSelector:#method: forClass:class
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   236
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   237
    "Created: / 17-10-2014 / 22:31:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   238
!
340954b48789 better comment in CustomNamespace >> execute
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 698
diff changeset
   239
698
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   240
test_not_available_in_class_perspective
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   241
    | perspective |
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   242
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   243
    perspective := CustomPerspective classPerspective.
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   244
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   245
    self deny: (generatorOrRefactoring class availableInPerspective:perspective).
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   246
525d39491ecc show CustomCodeSelectionToResourceTranslation refactoring only in code view menu and only if some code is selected
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 688
diff changeset
   247
    "Created: / 15-10-2014 / 08:11:43 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
645
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   248
! !
38a38c28ddb1 work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents:
diff changeset
   249
726
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   250
!CustomCodeSelectionToResourceTranslationTests class methodsFor:'documentation'!
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   251
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   252
version_HG
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   253
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   254
    ^ '$Changeset: <not expanded> $'
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   255
! !
d0dec838632e check for nil in availableInContext: and switch to replace in context for CustomCodeSelectionToResourceTranslation
Jakub Nesveda <jakubnesveda@seznam.cz>
parents: 704
diff changeset
   256