Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/NewTools-Scopes-Tests/ScopesManagerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,36 @@ ScopesManagerTest >> testEditClassScopeRemovingClassAndBreakingFullPackage [

]

{ #category : 'tests' }
ScopesManagerTest >> testMatchingPackageScopeEquality [

| scope1 scope2 scope3 pkgA pkgB |
pkgA := RBPackage named: 'Kernel-Core'.
pkgB := RBPackage named: 'Collections-Core'.
scope1 := ClyMatchingPackageScope ofAll: { pkgA } in: nil withName: 'Kernel-'.
scope2 := ClyMatchingPackageScope ofAll: { pkgA } in: nil withName: 'Kernel-'.

self assert: scope1 = scope2.
scope3 := ClyMatchingPackageScope ofAll: { pkgA } in: nil withName: 'Kernel-Core-'.
self deny: scope1 = scope3.
scope3 := ClyMatchingPackageScope ofAll: { pkgB } in: nil withName: 'Collections-'.
self deny: scope1 = scope3
]

{ #category : 'tests' }
ScopesManagerTest >> testMatchingPackageScopeHash [

| scope1 scope2 scope3 pkgA pkgB |
pkgA := RBPackage named: 'Kernel-Core'.
pkgB := RBPackage named: 'Collections-Core'.

scope1 := ClyMatchingPackageScope ofAll: { pkgA } in: nil withName: 'Kernel-'.
scope2 := ClyMatchingPackageScope ofAll: { pkgA } in: nil withName: 'Kernel-'.
scope3 := ClyMatchingPackageScope ofAll: { pkgB } in: nil withName: 'Collections-'.
self assert: scope1 hash equals: scope2 hash.
self deny: scope1 hash equals: scope3 hash
]

{ #category : 'tests' }
ScopesManagerTest >> testNewScopeFromAPackageWithExtendedClasses [
| packages scope |
Expand Down Expand Up @@ -200,3 +230,24 @@ ScopesManagerTest >> testNewScopeFromASinglePackageAndSomeOfItsClasses [
self assert: scope definedClasses equals: ScClassA1 package definedClasses.
self assert: scope orphanClasses asSet equals: Set new
]

{ #category : 'tests' }
ScopesManagerTest >> testSplitOnMatchingScopesFiltersByPrefix [

| packages scope splitScopes collected |
packages := OrderedCollection new.
packages add: (RBPackage named: 'Kernel-ExtraUtils').
packages add: (RBPackage named: 'Kernel-Tests').
packages add: (RBPackage named: 'Collections-Strings').

scope := ClyMatchingPackageScope ofAll: packages in: nil withName: ''.
splitScopes := scope splitOnMatchingScopes.

collected := OrderedCollection new.
splitScopes do: [ :s | s packagesDo: [ :p | collected add: p name ] ].

self assert: splitScopes size equals: 2.
self assert: (collected includes: 'Kernel-ExtraUtils').
self assert: (collected includes: 'Kernel-Tests').
self assert: (collected includes: 'Collections-Strings')
]
Loading