work in progress - create selection replace API in CustomRefactoryBuilder and CustomCodeSelectionToResourceTranslation
"{ Package: 'jn:refactoring_custom' }"
CustomCodeGeneratorOrRefactoringTestCase subclass:#CustomCodeSelectionToResourceTranslationTests
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Interface-Refactoring-Custom-Tests'
!
!CustomCodeSelectionToResourceTranslationTests methodsFor:'accessing'!
generatorOrRefactoring
^ CustomCodeSelectionToResourceTranslation new
! !
!CustomCodeSelectionToResourceTranslationTests methodsFor:'tests'!
test_code_selection_replaced_by_resource_translation_01
| expectedSource originalSource codeSelection class |
originalSource := 'selector
self information: ''Translate this''.
^ self.'.
class := codeBuilder createClassImmediate: 'DummyClassForTestCase01' instanceVariableNames: 'resources'.
codeBuilder createMethodImmediate: class source: originalSource.
codeSelection := CustomSourceCodeSelection new.
codeSelection
currentSourceCode: originalSource;
selectedClass: class;
selectedInterval: (32 to: 48);
selectedMethod: (class compiledMethodAt: #selector);
selectedSelector: #selector.
context selectedCodes: (Array with: codeSelection).
generatorOrRefactoring executeInContext: context.
expectedSource := 'selector
self information: (resources string: (''Translate this'')).
^ self.'.
self assertMethodSource:expectedSource atSelector:#selector
"Created: / 23-08-2014 / 20:09:06 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
"Modified: / 24-08-2014 / 09:52:39 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
! !