Skip to content

Commit

Permalink
Add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Apr 18, 2024
1 parent f04e783 commit c780629
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ LaunchpadCommandLineHandlerTest >> testApplicationConfiguration [

self
assert: runningApplication configuration name equals: 'John';
assert: runningApplication configuration title isEmpty.
assert: runningApplication configuration title isEmpty;
assert: ( runningApplication configuration valueAt: #name ) equals: 'John';
assert: ( runningApplication configuration valueAt: #title ) isEmpty.

self dryRun: LaunchpadGreeterApplication withAll: #( '--name=John' '--title=Dr.' ).

self
assert: runningApplication configuration name equals: 'John';
assert: runningApplication configuration title equals: 'Dr.'
assert: runningApplication configuration title equals: 'Dr.';
assert: ( runningApplication configuration valueAt: #name ) equals: 'John';
assert: ( runningApplication configuration valueAt: #title ) equals: 'Dr.';
should: [ runningApplication configuration valueAt: #unknown ] raise: Error
]

{ #category : 'tests' }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"
A LaunchpadDryRunProcessingContextTest is a test class for testing the behavior of LaunchpadDryRunProcessingContext
"
Class {
#name : 'LaunchpadDryRunProcessingContextTest',
#superclass : 'TestCase',
#category : 'Launchpad-Commands-Tests',
#package : 'Launchpad-Commands-Tests'
}

{ #category : 'tests' }
LaunchpadDryRunProcessingContextTest >> testConverting [

| context |

context := LaunchpadDryRunProcessingContext handling: ( CommandLineArguments withArguments: #( ) ).

self assert: context asDryRunContext equals: context
]
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ LaunchpadCommandLineHandler class >> description [

{ #category : 'activation' }
LaunchpadCommandLineHandler >> activate [
"shouldn't really be called anymore, divert to #activateWithContext:"

self activateWithContext: (self class defaultContextForCommandLine: self commandLine)

<ignoreForCoverage>
self shouldNotImplement
]

{ #category : 'activation' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,8 @@ ApplicationConfiguration >> synchronizeValuesWith: resolvedValues [

{ #category : 'accessing' }
ApplicationConfiguration >> valueAt: aKey [
"For configuration access without DNU handling, provide standard Dictionary api.
With normal configuration parameters, there should never be an absent value, so use default Dictionary error handling for an absent key"

^values at: aKey

^ self valueAt: aKey ifAbsent: [ KeyNotFound signalFor: aKey ]
]

{ #category : 'accessing' }
Expand Down

0 comments on commit c780629

Please sign in to comment.