Skip to content

Commit 790e2b8

Browse files
committed
Issue #783: remove trait; adjust spec_0085 for Issue #931 and move trait to symbol dictionary is working correctly
1 parent 05f1855 commit 790e2b8

File tree

2 files changed

+294
-3
lines changed

2 files changed

+294
-3
lines changed

rowan/src/Rowan-TestsV3/RwRowanSample9V3Test.class.st

+152-1
Original file line numberDiff line numberDiff line change
@@ -3259,6 +3259,63 @@ RwRowanSample9V3Test >> testSpec_0085_03_to_02 [
32593259
expectedProjectNames: projectNames.
32603260
]
32613261

3262+
{ #category : 'tests' }
3263+
RwRowanSample9V3Test >> testSpec_0085_03_to_03_removeTrait [
3264+
"load spec_0085 C03, T03, Tr03 then load spec_0085 C03, T03 - load without trait"
3265+
3266+
"https://github.com/GemTalk/Rowan/issues/783"
3267+
3268+
| loadSpec projectName projectNames loadSpecs loadedProjects trait1 project audit class1 |
3269+
loadSpec := self _loadSpecNamed: 'spec_0085'.
3270+
3271+
projectName := loadSpec projectName.
3272+
projectNames := {projectName }.
3273+
3274+
projectNames do: [:pn |
3275+
(Rowan image loadedProjectNamed: pn ifAbsent: [ ])
3276+
ifNotNil: [ :proj | Rowan image _removeLoadedProject: proj ] ].
3277+
3278+
"resolve project"
3279+
loadSpec customConditionalAttributes: { 'C03' . 'T03' . 'Tr03' }.
3280+
loadSpecs := loadSpec resolve.
3281+
3282+
"load project: C01, T01, Tr01"
3283+
loadedProjects := loadSpecs load.
3284+
project := loadedProjects projectNamed: projectName.
3285+
3286+
"validate"
3287+
self assert: (audit := project audit) isEmpty.
3288+
self
3289+
_standard_validateLoadedProjects: loadedProjects
3290+
expectedProjectNames: projectNames.
3291+
3292+
class1 := Rowan globalNamed: 'RowanSample9V3Class1'.
3293+
self assert: class1 classHistory size equals: 1.
3294+
3295+
trait1 := Rowan globalNamed: 'RowanSample9V3Trait1'.
3296+
self assert: ((ClassOrganizer new traits) includes: trait1) description: 'trait1 is unexpectedly not present'.
3297+
self assert: ((System myUserProfile symbolList dictionaryAndSymbolOf: trait1) at: 1) name equals: #'RowanSample9_1'.
3298+
3299+
"resolve project"
3300+
loadSpec customConditionalAttributes: { 'C03' . 'T03' }.
3301+
loadSpecs := loadSpec resolve.
3302+
3303+
"load project: C03, T03 (no trait included) on top of C03, T03, Tr03 - should load cleanly"
3304+
loadedProjects := loadSpecs load.
3305+
project := loadedProjects projectNamed: projectName.
3306+
3307+
"validate"
3308+
self assert: (audit := project audit) isEmpty.
3309+
self
3310+
_standard_validateLoadedProjects: loadedProjects
3311+
expectedProjectNames: projectNames.
3312+
3313+
trait1 := Rowan globalNamed: 'RowanSample9V3Trait1'.
3314+
self assert: trait1 isNil description: 'trait1 is unexpectedly present'.
3315+
self assert: class1 traits asArray equals: #().
3316+
self assert: class1 classTraits asArray equals: #().
3317+
]
3318+
32623319
{ #category : 'tests' }
32633320
RwRowanSample9V3Test >> testSpec_0085_03_to_04 [
32643321
"load spec_0085 C03, T03, Tr03 then load spec_0085 C02, T02, Tr04 - remove/add instance, class instance and class variables"
@@ -3312,6 +3369,65 @@ RwRowanSample9V3Test >> testSpec_0085_03_to_04 [
33123369
self assert: ((System myUserProfile symbolList dictionaryAndSymbolOf: trait1) at: 1) name equals: #'RowanSample9_2'
33133370
]
33143371

3372+
{ #category : 'tests' }
3373+
RwRowanSample9V3Test >> testSpec_0085_03_to_05 [
3374+
"load spec_0085 C03, T03, Tr03 then load spec_0085 C05, T05, Tr05 - add instance variable independent of trait"
3375+
3376+
"https://github.com/GemTalk/Rowan/issues/783"
3377+
3378+
| loadSpec projectName projectNames loadSpecs loadedProjects trait1 project audit class1 |
3379+
loadSpec := self _loadSpecNamed: 'spec_0085'.
3380+
3381+
projectName := loadSpec projectName.
3382+
projectNames := {projectName }.
3383+
3384+
projectNames do: [:pn |
3385+
(Rowan image loadedProjectNamed: pn ifAbsent: [ ])
3386+
ifNotNil: [ :proj | Rowan image _removeLoadedProject: proj ] ].
3387+
3388+
"resolve project"
3389+
loadSpec customConditionalAttributes: { 'C03' . 'T03' . 'Tr03' }.
3390+
loadSpecs := loadSpec resolve.
3391+
3392+
"load project: C01, T01, Tr01"
3393+
loadedProjects := loadSpecs load.
3394+
project := loadedProjects projectNamed: projectName.
3395+
3396+
"validate"
3397+
self assert: (audit := project audit) isEmpty.
3398+
self
3399+
_standard_validateLoadedProjects: loadedProjects
3400+
expectedProjectNames: projectNames.
3401+
3402+
class1 := Rowan globalNamed: 'RowanSample9V3Class1'.
3403+
self assert: class1 classHistory size equals: 1.
3404+
3405+
trait1 := Rowan globalNamed: 'RowanSample9V3Trait1'.
3406+
self assert: ((ClassOrganizer new traits) includes: trait1) description: 'trait1 is unexpectedly not present'.
3407+
self assert: ((System myUserProfile symbolList dictionaryAndSymbolOf: trait1) at: 1) name equals: #'RowanSample9_1'.
3408+
3409+
"resolve project"
3410+
loadSpec customConditionalAttributes: { 'C05' . 'T05' . 'Tr05' }.
3411+
loadSpecs := loadSpec resolve.
3412+
3413+
"load project: C05, T05, Tr05 on top of C03, T03, Tr04 - should load cleanly"
3414+
loadedProjects := loadSpecs load.
3415+
project := loadedProjects projectNamed: projectName.
3416+
3417+
"validate"
3418+
self assert: (audit := project audit) isEmpty.
3419+
self
3420+
_standard_validateLoadedProjects: loadedProjects
3421+
expectedProjectNames: projectNames.
3422+
3423+
class1 := Rowan globalNamed: 'RowanSample9V3Class1'.
3424+
self assert: class1 classHistory size equals: 2.
3425+
3426+
trait1 := Rowan globalNamed: 'RowanSample9V3Trait1'.
3427+
self assert: ((ClassOrganizer new traits) includes: trait1) description: 'trait1 is unexpectedly not present'.
3428+
self assert: ((System myUserProfile symbolList dictionaryAndSymbolOf: trait1) at: 1) name equals: #'RowanSample9_1'.
3429+
]
3430+
33153431
{ #category : 'tests' }
33163432
RwRowanSample9V3Test >> testSpec_0085_04 [
33173433
"spec_0085 C03, T03, Tr04 should load cleanly - move trait to a different symbol dictionary"
@@ -3344,10 +3460,45 @@ RwRowanSample9V3Test >> testSpec_0085_04 [
33443460

33453461
trait1 := Rowan globalNamed: 'RowanSample9V3Trait1'.
33463462
self assert: ((ClassOrganizer new traits) includes: trait1) description: 'trait1 is unexpectedly not present'.
3347-
33483463
self assert: ((System myUserProfile symbolList dictionaryAndSymbolOf: trait1) at: 1) name equals: #'RowanSample9_2'
33493464
]
33503465

3466+
{ #category : 'tests' }
3467+
RwRowanSample9V3Test >> testSpec_0085_05 [
3468+
"spec_0085 C05, T05, Tr05 should load cleanly - move trait to a different symbol dictionary"
3469+
3470+
"https://github.com/GemTalk/Rowan/issues/783"
3471+
3472+
| loadSpec projectName projectNames loadSpecs loadedProjects trait1 project audit |
3473+
loadSpec := self _loadSpecNamed: 'spec_0085'.
3474+
3475+
projectName := loadSpec projectName.
3476+
projectNames := {projectName }.
3477+
3478+
projectNames do: [:pn |
3479+
(Rowan image loadedProjectNamed: pn ifAbsent: [ ])
3480+
ifNotNil: [ :proj | Rowan image _removeLoadedProject: proj ] ].
3481+
3482+
"resolve project"
3483+
loadSpec customConditionalAttributes: { 'C05' . 'T05' . 'Tr05' }.
3484+
loadSpecs := loadSpec resolve.
3485+
3486+
"load project"
3487+
loadedProjects := loadSpecs load.
3488+
project := loadedProjects projectNamed: projectName.
3489+
3490+
"validate"
3491+
self assert: (audit := project audit) isEmpty.
3492+
self
3493+
_standard_validateLoadedProjects: loadedProjects
3494+
expectedProjectNames: projectNames.
3495+
3496+
trait1 := Rowan globalNamed: 'RowanSample9V3Trait1'.
3497+
self assert: ((ClassOrganizer new traits) includes: trait1) description: 'trait1 is unexpectedly not present'.
3498+
3499+
self assert: ((System myUserProfile symbolList dictionaryAndSymbolOf: trait1) at: 1) name equals: #'RowanSample9_1'
3500+
]
3501+
33513502
{ #category : 'tests' }
33523503
RwRowanSample9V3Test >> testSpec_0085_C03_T03_Tr02 [
33533504
"spec_0085 C03, T03, Tr02 should explode"

rowan/src/Rowan-TestsV3/RwTestProjectLibraryGeneratorV3.class.st

+142-2
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,7 @@ List of condition tuples intended to work together, since they were built togeth
10271027
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
10281028
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
10291029
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
1030+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
10301031
10311032
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
10321033
"
@@ -1144,6 +1145,7 @@ List of condition tuples intended to work together, since they were built togeth
11441145
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
11451146
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
11461147
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
1148+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
11471149
11481150
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
11491151
"
@@ -1282,6 +1284,7 @@ List of condition tuples intended to work together, since they were built togeth
12821284
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
12831285
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
12841286
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
1287+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
12851288
12861289
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
12871290
"
@@ -1400,6 +1403,7 @@ List of condition tuples intended to work together, since they were built togeth
14001403
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
14011404
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
14021405
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
1406+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
14031407
14041408
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
14051409
"
@@ -1421,12 +1425,23 @@ Interesting things could happen when different conditions are mixed together, bu
14211425
toComponentNamed: 'Core';
14221426
yourself.
14231427

1424-
packageName2 := projectName , '-' , 'Tr' , index.
1428+
packageName2 := projectName , '-' , 'Tr' , traitIndex.
14251429

14261430
resolvedProject
14271431
addPackagesNamed: {packageName2} toComponentNamed: componentName2;
14281432
yourself.
14291433

1434+
((resolvedProject packageNamed: packageName2)
1435+
addTraitNamed: traitName
1436+
instvars: #('iv2')
1437+
classinstvars: #('civ2')
1438+
classvars: #('Cv2')
1439+
category: packageName2)
1440+
addInstanceMethod: 'iv2_t ^ iv2' protocol: 'accessing';
1441+
addInstanceMethod: 'cv2_t ^ Cv2' protocol: 'accessing';
1442+
addClassMethod: 'civ2_t ^ civ2' protocol: 'accessing';
1443+
yourself.
1444+
14301445
(resolvedProject componentNamed: componentName2)
14311446
conditionalPackageMapSpecsAtGemStoneUserId: RwLoadSpecificationV2 _gemstoneAllUsersName
14321447
andPackageName: packageName2
@@ -1435,6 +1450,128 @@ Interesting things could happen when different conditions are mixed together, bu
14351450
^ resolvedProject
14361451
]
14371452

1453+
{ #category : 'private' }
1454+
RwTestProjectLibraryGeneratorV3 >> _addDefinitionsFor_0085_E: resolvedProject [
1455+
"Start from scratch and build a package/component structure for testing different Class/Trait combinations. Classes are in separate C* packages. Traits are in separate Tr* packages. Tests are in separate T* packages. Each C* package is in a C* conditional (C*) component. Each Tr* package is in a Tr* conditional (Tr*) component. Each Test* package is in a Test* conditional (C*-T*) component. There is a Test package for Core/Trait combo. The idea is that we can test a significant number of Class/Trait combinations in a single project using conditions to control what is loaded.
1456+
1457+
List of condition tuples intended to work together, since they were built together:
1458+
A. C01, Tr01, T01 - baseline
1459+
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
1460+
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
1461+
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
1462+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
1463+
1464+
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
1465+
"
1466+
1467+
| componentName1 componentName2 componentName3 componentName4 componentName5 packageName1 packageName2 packageName3 packageName4 packageName5 traitName className1 className2 index |
1468+
1469+
traitName := projectName , 'Trait1'.
1470+
className1 := projectName , 'Class1'.
1471+
className2 := projectName , 'TestCase'.
1472+
1473+
index := '05'.
1474+
componentName1 := 'C' , index.
1475+
componentName2 := 'Tr' , index.
1476+
componentName3 := 'T' , index.
1477+
componentName4 := 'T' , index , '_class'.
1478+
componentName5 := 'T' , index , '_trait'.
1479+
resolvedProject
1480+
addSubcomponentNamed: componentName1
1481+
condition: 'C' , index
1482+
comment: 'Class ', index, ' package'
1483+
toComponentNamed: 'Core';
1484+
addSubcomponentNamed: componentName2
1485+
condition: 'Tr' , index
1486+
comment: 'Trait ', index, ' package'
1487+
toComponentNamed: 'Core';
1488+
addSubcomponentNamed: componentName3
1489+
condition: 'T' , index
1490+
comment: 'Test ', index, ' package'
1491+
toComponentNamed: 'Core';
1492+
addSubcomponentNamed: componentName4
1493+
condition: 'C' , index
1494+
comment: 'Class Test ', index, ' package'
1495+
toComponentNamed: componentName3;
1496+
addSubcomponentNamed: componentName5
1497+
condition: 'Tr' , index
1498+
comment: 'Trait Test ', index, ' package'
1499+
toComponentNamed: componentName3;
1500+
yourself.
1501+
1502+
1503+
packageName1 := projectName , '-' , 'C' , index.
1504+
packageName2 := projectName , '-' , 'Tr' , index.
1505+
packageName3 := projectName , '-' , 'T' , index.
1506+
packageName4 := projectName , '-' , 'C' , '-' , 'T' , index.
1507+
packageName5 := projectName , '-' , 'Tr' , '-' , 'T' , index.
1508+
resolvedProject
1509+
addPackagesNamed: {packageName1} toComponentNamed: componentName1;
1510+
addPackagesNamed: {packageName2} toComponentNamed: componentName2;
1511+
addPackagesNamed: {packageName3} toComponentNamed: componentName3;
1512+
addPackagesNamed: {packageName4} toComponentNamed: componentName4;
1513+
addPackagesNamed: {packageName5} toComponentNamed: componentName5;
1514+
yourself.
1515+
((resolvedProject packageNamed: packageName1)
1516+
addClassNamed: className1
1517+
super: 'Object'
1518+
instvars: #('iv2' 'iv5')
1519+
classinstvars: #('civ2')
1520+
classvars: #('Cv2')
1521+
category: packageName1
1522+
comment: 'I am an example class')
1523+
traits: traitName;
1524+
classTraits: traitName , ' classTrait';
1525+
addInstanceMethod: 'iv2 ^ iv2' protocol: 'accessing';
1526+
addInstanceMethod: 'iv5 ^ iv5' protocol: 'accessing';
1527+
addInstanceMethod: 'cv2 ^ Cv2' protocol: 'accessing';
1528+
addClassMethod: 'civ2 ^ civ2' protocol: 'accessing';
1529+
yourself.
1530+
((resolvedProject packageNamed: packageName2)
1531+
addTraitNamed: traitName
1532+
instvars: #('iv2')
1533+
classinstvars: #('civ2')
1534+
classvars: #('Cv2')
1535+
category: packageName2)
1536+
addInstanceMethod: 'iv2_t ^ iv2' protocol: 'accessing';
1537+
addInstanceMethod: 'cv2_t ^ Cv2' protocol: 'accessing';
1538+
addClassMethod: 'civ2_t ^ civ2' protocol: 'accessing';
1539+
yourself.
1540+
(resolvedProject packageNamed: packageName3)
1541+
addClassNamed: className2
1542+
super: 'TestCase'
1543+
category: packageName3
1544+
comment: 'I test the example class'.
1545+
((resolvedProject packageNamed: packageName4)
1546+
addClassExtensionNamed: className2)
1547+
addInstanceMethod: 'testIv2 self assert: ' , className1 , ' new iv2 = nil'
1548+
protocol: 'tests';
1549+
addInstanceMethod: 'testIv5 self assert: ' , className1 , ' new iv5 = nil'
1550+
protocol: 'tests';
1551+
addInstanceMethod: 'testCiv2 self assert: ' , className1 , ' civ2 = nil'
1552+
protocol: 'tests';
1553+
addInstanceMethod: 'testCv2 self assert: ' , className1 , ' new cv2 = nil'
1554+
protocol: 'tests';
1555+
yourself.
1556+
((resolvedProject packageNamed: packageName5)
1557+
addClassExtensionNamed: className2)
1558+
addInstanceMethod:
1559+
'testIv2_t self assert: ' , className1 , ' new iv2_t = nil'
1560+
protocol: 'tests';
1561+
addInstanceMethod: 'testCiv2_t self assert: ' , className1 , ' civ2_t = nil'
1562+
protocol: 'tests';
1563+
addInstanceMethod:
1564+
'testCv2_t self assert: ' , className1 , ' new cv2_t = nil'
1565+
protocol: 'tests';
1566+
addInstanceMethod:
1567+
'testTrait self assert: ((ClassOrganizer new traits) includes: ' , traitName
1568+
, ')'
1569+
protocol: 'tests';
1570+
yourself.
1571+
1572+
^ resolvedProject
1573+
]
1574+
14381575
{ #category : 'private' }
14391576
RwTestProjectLibraryGeneratorV3 >> _addDefinitionsFor_0085: resolvedProject [
14401577
"Start from scratch and build a package/component structure for testing different Class/Trait combinations. Classes are in separate C* packages. Traits are in separate Tr* packages. Tests are in separate T* packages. Each C* package is in a C* conditional (C*) component. Each Tr* package is in a Tr* conditional (Tr*) component. Each Test* package is in a Test* conditional (C*-T*) component. There is a Test package for Core/Trait combo. The idea is that we can test a significant number of Class/Trait combinations in a single project using conditions to control what is loaded.
@@ -1444,6 +1581,7 @@ List of condition tuples intended to work together, since they were built togeth
14441581
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
14451582
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
14461583
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
1584+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
14471585
14481586
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
14491587
"
@@ -1455,7 +1593,7 @@ Interesting things could happen when different conditions are mixed together, bu
14551593
self _addDefinitionsFor_0085_B: resolvedProject.
14561594
self _addDefinitionsFor_0085_C: resolvedProject.
14571595
self _addDefinitionsFor_0085_D: resolvedProject.
1458-
true ifTrue: [ ^ resolvedProject ].
1596+
self _addDefinitionsFor_0085_E: resolvedProject.
14591597
^ resolvedProject
14601598
]
14611599

@@ -2353,6 +2491,7 @@ List of condition tuples intended to work together, since they were built togeth
23532491
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
23542492
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
23552493
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
2494+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
23562495
23572496
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.
23582497
"
@@ -2374,6 +2513,7 @@ List of condition tuples intended to work together, since they were built togeth
23742513
B. C02, Tr02, T02 - C01, Tr01, T01 and add IV to class, trait and tests
23752514
C. C03, Tr03, T03 - C02, Tr02, T02 - C01, Tr01, T01 and remove IV from class, trait and tests
23762515
D. C03, Tr04, T03 - Tr04 moves trait to a different symbol dictionary than Tr03
2516+
E. C05, Tr05, T05 - C03, Tr03, T03 and add IV to class only and tests
23772517
```
23782518
23792519
Interesting things could happen when different conditions are mixed together, but transitions between built tuples should always work.'.

0 commit comments

Comments
 (0)