From d7b8103ce9a7f10fa520cdfb91999c5a956f43bf Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Tue, 26 Sep 2023 12:02:22 +0200 Subject: [PATCH] Use a test resource to compile less classes This PR makes tests almost instant using a test resource to compile classes --- .../AbstractTonelTest.class/class/resources.st | 4 ++++ .../instance/classWithTraits.st | 12 ++---------- .../classWithTraitsWithClassComposition.st | 13 ++----------- .../AbstractTonelTest.class/instance/trait1.st | 7 ++----- .../AbstractTonelTest.class/instance/trait2.st | 7 ++----- .../AbstractTonelTest.class/properties.json | 8 +------- .../TonelTestResource.class/README.md | 1 + .../instance/classWithTraits.st | 12 ++++++++++++ .../classWithTraitsWithClassComposition.st | 13 +++++++++++++ .../instance/setUp.st | 0 .../instance/tearDown.st | 0 .../TonelTestResource.class/instance/trait1.st | 7 +++++++ .../TonelTestResource.class/instance/trait2.st | 7 +++++++ .../TonelTestResource.class/properties.json | 17 +++++++++++++++++ 14 files changed, 70 insertions(+), 38 deletions(-) create mode 100644 MonticelloTonel-Tests.package/AbstractTonelTest.class/class/resources.st create mode 100644 MonticelloTonel-Tests.package/TonelTestResource.class/README.md create mode 100644 MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraits.st create mode 100644 MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraitsWithClassComposition.st rename MonticelloTonel-Tests.package/{AbstractTonelTest.class => TonelTestResource.class}/instance/setUp.st (100%) rename MonticelloTonel-Tests.package/{AbstractTonelTest.class => TonelTestResource.class}/instance/tearDown.st (100%) create mode 100644 MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait1.st create mode 100644 MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait2.st create mode 100644 MonticelloTonel-Tests.package/TonelTestResource.class/properties.json diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/class/resources.st b/MonticelloTonel-Tests.package/AbstractTonelTest.class/class/resources.st new file mode 100644 index 0000000..31c8461 --- /dev/null +++ b/MonticelloTonel-Tests.package/AbstractTonelTest.class/class/resources.st @@ -0,0 +1,4 @@ +accessing +resources + + ^ { TonelTestResource } \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraits.st b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraits.st index 7af96bf..ef9f6ec 100644 --- a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraits.st +++ b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraits.st @@ -1,12 +1,4 @@ -utils +utilities classWithTraits - ^ classWithTraits ifNil: [ - classWithTraits := self class classInstaller make: [ :aBuilder | - aBuilder - name: #SomeObject; - superclass: Object; - traitComposition: self trait1 + self trait2; - package: #'MonticelloTonel-Tests' ]. - classesAndTraits add: classWithTraits. - classWithTraits ] \ No newline at end of file + ^ TonelTestResource current classWithTraits \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraitsWithClassComposition.st b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraitsWithClassComposition.st index 551aa37..ed5aec6 100644 --- a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraitsWithClassComposition.st +++ b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/classWithTraitsWithClassComposition.st @@ -1,13 +1,4 @@ -utils +utilities classWithTraitsWithClassComposition - ^ classWithTraitsWithClassComposition ifNil: [ - classWithTraitsWithClassComposition := self class classInstaller make: [ :aBuilder | - aBuilder - name: #SomeObject2; - superclass: Object; - traitComposition: self trait1 + self trait2; - classTraitComposition: self trait1 classTrait + self trait2 classTrait - #m1; - package: #'MonticelloTonel-Tests' ]. - classesAndTraits add: classWithTraitsWithClassComposition. - classWithTraitsWithClassComposition ] \ No newline at end of file + ^ TonelTestResource current classWithTraitsWithClassComposition \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait1.st b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait1.st index c5b654d..13a034c 100644 --- a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait1.st +++ b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait1.st @@ -1,7 +1,4 @@ -utils +utilities trait1 - ^ trait1 ifNil: [ - trait1 := Trait named: #T1 uses: #() package: #'MonticelloTonel-Tests'. - classesAndTraits add: trait1. - trait1 ] \ No newline at end of file + ^ TonelTestResource current trait1 \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait2.st b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait2.st index c6a0c41..9e1ca90 100644 --- a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait2.st +++ b/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/trait2.st @@ -1,7 +1,4 @@ -utils +utilities trait2 - ^ trait2 ifNil: [ - trait2 := Trait named: #T2 uses: #() package: #'MonticelloTonel-Tests'. - classesAndTraits add: trait2. - trait2 ] \ No newline at end of file + ^ TonelTestResource current trait2 \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/properties.json b/MonticelloTonel-Tests.package/AbstractTonelTest.class/properties.json index ccaca19..606bc9a 100644 --- a/MonticelloTonel-Tests.package/AbstractTonelTest.class/properties.json +++ b/MonticelloTonel-Tests.package/AbstractTonelTest.class/properties.json @@ -5,13 +5,7 @@ "classinstvars" : [ ], "pools" : [ ], "classvars" : [ ], - "instvars" : [ - "classesAndTraits", - "classWithTraits", - "trait1", - "trait2", - "classWithTraitsWithClassComposition" - ], + "instvars" : [ ], "name" : "AbstractTonelTest", "type" : "normal" } \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/TonelTestResource.class/README.md b/MonticelloTonel-Tests.package/TonelTestResource.class/README.md new file mode 100644 index 0000000..023ab08 --- /dev/null +++ b/MonticelloTonel-Tests.package/TonelTestResource.class/README.md @@ -0,0 +1 @@ +I am a test resource holding some classes for Tonel to use for the reading and writing tests. \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraits.st b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraits.st new file mode 100644 index 0000000..12d8a66 --- /dev/null +++ b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraits.st @@ -0,0 +1,12 @@ +accessing +classWithTraits + + ^ classWithTraits ifNil: [ + classWithTraits := self class classInstaller make: [ :aBuilder | + aBuilder + name: #SomeObject; + superclass: Object; + traitComposition: self trait1 + self trait2; + package: #'MonticelloTonel-Tests' ]. + classesAndTraits add: classWithTraits. + classWithTraits ] \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraitsWithClassComposition.st b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraitsWithClassComposition.st new file mode 100644 index 0000000..82cc24b --- /dev/null +++ b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/classWithTraitsWithClassComposition.st @@ -0,0 +1,13 @@ +accessing +classWithTraitsWithClassComposition + + ^ classWithTraitsWithClassComposition ifNil: [ + classWithTraitsWithClassComposition := self class classInstaller make: [ :aBuilder | + aBuilder + name: #SomeObject2; + superclass: Object; + traitComposition: self trait1 + self trait2; + classTraitComposition: self trait1 classTrait + self trait2 classTrait - #m1; + package: #'MonticelloTonel-Tests' ]. + classesAndTraits add: classWithTraitsWithClassComposition. + classWithTraitsWithClassComposition ] \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/setUp.st b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/setUp.st similarity index 100% rename from MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/setUp.st rename to MonticelloTonel-Tests.package/TonelTestResource.class/instance/setUp.st diff --git a/MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/tearDown.st b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/tearDown.st similarity index 100% rename from MonticelloTonel-Tests.package/AbstractTonelTest.class/instance/tearDown.st rename to MonticelloTonel-Tests.package/TonelTestResource.class/instance/tearDown.st diff --git a/MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait1.st b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait1.st new file mode 100644 index 0000000..f4202a2 --- /dev/null +++ b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait1.st @@ -0,0 +1,7 @@ +accessing +trait1 + + ^ trait1 ifNil: [ + trait1 := Trait named: #T1 uses: #( ) package: #'MonticelloTonel-Tests'. + classesAndTraits add: trait1. + trait1 ] \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait2.st b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait2.st new file mode 100644 index 0000000..e5aee9d --- /dev/null +++ b/MonticelloTonel-Tests.package/TonelTestResource.class/instance/trait2.st @@ -0,0 +1,7 @@ +accessing +trait2 + + ^ trait2 ifNil: [ + trait2 := Trait named: #T2 uses: #( ) package: #'MonticelloTonel-Tests'. + classesAndTraits add: trait2. + trait2 ] \ No newline at end of file diff --git a/MonticelloTonel-Tests.package/TonelTestResource.class/properties.json b/MonticelloTonel-Tests.package/TonelTestResource.class/properties.json new file mode 100644 index 0000000..1a97b80 --- /dev/null +++ b/MonticelloTonel-Tests.package/TonelTestResource.class/properties.json @@ -0,0 +1,17 @@ +{ + "commentStamp" : "CyrilFerlicot 9/26/2023 12:01", + "super" : "TestResource", + "category" : "MonticelloTonel-Tests-Base", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "classesAndTraits", + "classWithTraits", + "trait1", + "trait2", + "classWithTraitsWithClassComposition" + ], + "name" : "TonelTestResource", + "type" : "normal" +} \ No newline at end of file