Issue 134 in metacello: MetacelloBrowser: Tests: Expected error message does not match for MBAddConfigurationCommandTest

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 134 in metacello: MetacelloBrowser: Tests: Expected error message does not match for MBAddConfigurationCommandTest

metacello
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Product-Core

New issue 134 by [hidden email]: MetacelloBrowser: Tests: Expected  
error message does not match for MBAddConfigurationCommandTest
http://code.google.com/p/metacello/issues/detail?id=134

On Squeak 4.2,
Running MBAddConfigurationCommandTest>>#testExecute
fails because the expected message is

Class #ConfigurationOfMetacello_Command_Tests already exist

but Squeak supplies

Class 'ConfigurationOfMetacello_Command_Tests' already exist

FWIW, I think Test that expect a certain Error-Description
is error-prone.

However, this can be fixed by changing
MBAddConfigurationCommand>>#execute
and
MBAddConfigurationCommandTest>>#testExecute

MBAddConfigurationCommand>>#execute
        | configurationClassName versionNumber addedPackages addedConfigurations  
repository projectName mcPackage workingCopy |
- configurationClassName := self askForClassName.
- configurationClassName ifNil: [ ^ self ].
+ configurationClassName := self askForClassName
+ ifNil: [^ self]
+ ifNotNil: [:name | name asSymbol]
        Smalltalk globals
- at: configurationClassName asSymbol
+ at: configurationClassName
                ifPresent: [ :ex | ^ self error: 'Class ' , configurationClassName  
printString , ' already exist' ].
        projectName := MBToolBox baseNameOf: configurationClassName.
        (repository := self repositoryFor: projectName) ifNil: [ ^ self ].
        versionNumber := MBPlatform current request: 'Enter initial version  
number' initialAnswer: '1.0'.
        versionNumber ifNil: [ ^ self ].
        addedPackages := OrderedCollection new.
        addedConfigurations := OrderedCollection new.
        self collectPackages: addedPackages andProjects: addedConfigurations  
pattern: projectName , '*' repository: repository.
        self
                executeAddBaselineForConfigurationNamed: configurationClassName
                repositoryDescription: repository description
                versionString: versionNumber
                packages: addedPackages
                configurations: addedConfigurations.
        mcPackage := MCPackage named: configurationClassName.
        workingCopy := mcPackage workingCopy.
        workingCopy repositoryGroup addRepository: repository

MBAddConfigurationCommandTest>>#testExecute
        | t v |
        t := false.
        command := MBAddConfigurationCommand target: self for: nil.
        [[command execute] valueSupplyingAnswer: self configurationName  ]
                on: Error do: [:ex |
- t := ex messageText = 'Class #ConfigurationOfMetacello_Command_Tests  
already exist' ].
+ t := ex messageText = ('Class ',  
#'ConfigurationOfMetacello_Command_Tests' printString, ' already exist') ].
        self assert: t.
       
        v := 10000 atRandom.
        self should: [[command execute] valueSupplyingAnswers:
                {{'Name of the new Metacello configuration (e.g.,  
ConfigurationOfYourSoftware)'  . self configurationName, v asString  } .
                  {'Enter initial version number' . '1.0'} ".
                  {'Would you like to use  
http://www.squeaksource.com/Metacello_Command_Tests2, for your project?' .  
true}"
                }] raise: Exception.
               
        self deny: (Smalltalk globals includesKey: (self configurationName, v  
asString) asSymbol ).



Reply | Threaded
Open this post in threaded view
|

Re: Issue 134 in metacello: MetacelloBrowser: Tests: Expected error message does not match for MBAddConfigurationCommandTest

metacello
Updates:
        Labels: -Product-Core Product-Browser

Comment #1 on issue 134 by [hidden email]: MetacelloBrowser: Tests:  
Expected error message does not match for MBAddConfigurationCommandTest
http://code.google.com/p/metacello/issues/detail?id=134

(No comment was entered for this change.)