-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation and tests for add and remove classes from orEnvironments
- Loading branch information
Showing
12 changed files
with
153 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Class { | ||
#name : 'ScClassA1', | ||
#superclass : 'Object', | ||
#category : 'NewTools-Scopes-Resources-A-Tests', | ||
#package : 'NewTools-Scopes-Resources-A-Tests' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Class { | ||
#name : 'ScClassA2', | ||
#superclass : 'Object', | ||
#category : 'NewTools-Scopes-Resources-A-Tests', | ||
#package : 'NewTools-Scopes-Resources-A-Tests' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : 'NewTools-Scopes-Resources-A-Tests' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Class { | ||
#name : 'ScClassB1', | ||
#superclass : 'Object', | ||
#category : 'NewTools-Scopes-Resources-B-Tests', | ||
#package : 'NewTools-Scopes-Resources-B-Tests' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : 'NewTools-Scopes-Resources-B-Tests' } |
59 changes: 59 additions & 0 deletions
59
src/NewTools-Scopes-Tests/ScopesManagesOperationsTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Class { | ||
#name : 'ScopesManagesOperationsTest', | ||
#superclass : 'TestCase', | ||
#category : 'NewTools-Scopes-Tests', | ||
#package : 'NewTools-Scopes-Tests' | ||
} | ||
|
||
{ #category : 'tests' } | ||
ScopesManagesOperationsTest >> testAddClassAndFillPackageInOrEnvironment [ | ||
|
||
| packageEnv classEnvA1 orEnv | | ||
|
||
"class environment missing one class to complete the full package" | ||
classEnvA1 := RBBrowserEnvironment new forClasses: { ScClassA1 }. | ||
|
||
"empty package environment" | ||
packageEnv := RBBrowserEnvironment new forPackages: { }. | ||
|
||
orEnv := RBOrEnvironment onEnvironment: classEnvA1 or: packageEnv. | ||
|
||
orEnv addClass: ScClassA2. | ||
orEnv addClass: ScClassA2 class. | ||
|
||
self assert: orEnv allClasses equals: { ScClassA1 . ScClassA2 }. | ||
self assert: orEnv packages equals: { ScClassA1 package } | ||
] | ||
|
||
{ #category : 'tests' } | ||
ScopesManagesOperationsTest >> testRemoveClassInClassEnvironmentFromOrEnvironment [ | ||
|
||
| classEnvA1 packageEnvB orEnv | | ||
|
||
classEnvA1 := RBBrowserEnvironment new forClasses: { ScClassA1 }. | ||
packageEnvB := RBBrowserEnvironment new forPackages: { ScClassB1 package }. | ||
|
||
orEnv := RBOrEnvironment onEnvironment: classEnvA1 or: packageEnvB. | ||
orEnv removeClass: ScClassA1. | ||
orEnv removeClass: ScClassA1 class. | ||
|
||
self assert: orEnv allClasses asSet equals: ScClassB1 package definedClasses | ||
] | ||
|
||
{ #category : 'tests' } | ||
ScopesManagesOperationsTest >> testRemoveClassInPackageEnvironmentFromOrEnvironment [ | ||
|
||
| packageEnvA classEnv orEnv | | ||
|
||
"empty class environment" | ||
classEnv := RBBrowserEnvironment new forClasses: { }. | ||
|
||
"environment packageEnvA has two classes: ScClassA1 and ScClassA2" | ||
packageEnvA := RBBrowserEnvironment new forPackages: { ScClassA1 package }. | ||
|
||
orEnv := RBOrEnvironment onEnvironment: classEnv or: packageEnvA. | ||
orEnv removeClass: ScClassA1. | ||
orEnv removeClass: ScClassA1 class. | ||
|
||
self assert: orEnv allClasses equals: { ScClassA2 } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : 'NewTools-Scopes-Tests' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters