From b8f839035377826081d5d1a5e2cae6b195f62414 Mon Sep 17 00:00:00 2001 From: Enzo-Demeulenaere Date: Mon, 4 Dec 2023 10:42:40 +0100 Subject: [PATCH] Fixing Tests --- .../BlTextElementExamples.class.st | 13 ++++++ src/Bloc-UnitedTests/BlExamplesMock.class.st | 43 +++++++++---------- .../BlTestOfExamplesTest.class.st | 10 ++--- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/Bloc-Text-Alexandrie-Examples/BlTextElementExamples.class.st b/src/Bloc-Text-Alexandrie-Examples/BlTextElementExamples.class.st index f3d4e1bb2..38b50190f 100644 --- a/src/Bloc-Text-Alexandrie-Examples/BlTextElementExamples.class.st +++ b/src/Bloc-Text-Alexandrie-Examples/BlTextElementExamples.class.st @@ -31,6 +31,19 @@ BlTextElementExamples >> simpleText [ ^ textElement ] +{ #category : #tests } +BlTextElementExamples >> testTextElement [ + + + | text textElement | + text := self helloText. + textElement := BlTextElement new. + textElement text: text. + textElement clipChildren: false. + self assert: textElement text equals: text. + ^ textElement +] + { #category : #example } BlTextElementExamples >> textAttributes [ diff --git a/src/Bloc-UnitedTests/BlExamplesMock.class.st b/src/Bloc-UnitedTests/BlExamplesMock.class.st index 2f1df5c23..b8a308725 100644 --- a/src/Bloc-UnitedTests/BlExamplesMock.class.st +++ b/src/Bloc-UnitedTests/BlExamplesMock.class.st @@ -5,7 +5,7 @@ See my references. " Class { #name : #BlExamplesMock, - #superclass : #BlExampleTest, + #superclass : #TestCase, #instVars : [ 'enabled' ], @@ -19,45 +19,44 @@ BlExamplesMock >> enableRunning [ ] { #category : #examples } -BlExamplesMock >> exampleError [ +BlExamplesMock >> exampleWithArgument: arg [ - self error + ] -{ #category : #examples } -BlExamplesMock >> exampleFail [ +{ #category : #initialization } +BlExamplesMock >> initialize [ - self fail + super initialize. + enabled := false ] -{ #category : #examples } -BlExamplesMock >> examplePass [ - - +{ #category : #private } +BlExamplesMock >> performTest [ + + enabled ifTrue: [ super performTest ] ] { #category : #examples } -BlExamplesMock >> exampleSkip [ +BlExamplesMock >> testExampleError [ - self error ] { #category : #examples } -BlExamplesMock >> exampleWithArgument: arg [ +BlExamplesMock >> testExampleFail [ - + self fail ] -{ #category : #initialization } -BlExamplesMock >> initialize [ - - super initialize. - enabled := false +{ #category : #examples } +BlExamplesMock >> testExamplePass [ + + ] -{ #category : #private } -BlExamplesMock >> performTest [ +{ #category : #examples } +BlExamplesMock >> testExampleSkip [ - enabled ifTrue: [ super performTest ] + self skip ] diff --git a/src/Bloc-UnitedTests/BlTestOfExamplesTest.class.st b/src/Bloc-UnitedTests/BlTestOfExamplesTest.class.st index 6116287eb..b471650ee 100644 --- a/src/Bloc-UnitedTests/BlTestOfExamplesTest.class.st +++ b/src/Bloc-UnitedTests/BlTestOfExamplesTest.class.st @@ -18,7 +18,7 @@ BlTestOfExamplesTest >> testAllExamplesAreConsideredTests [ self assertCollection: BlExamplesMock testSelectors - hasSameElements: #(examplePass exampleFail exampleError exampleSkip) + hasSameElements: #(#testExamplePass #testExampleFail #testExampleError #testExampleSkip) ] @@ -27,7 +27,7 @@ BlTestOfExamplesTest >> testErrors [ self assertCollection: (self examplesTestResult errors collect: [ :each | each selector ]) - hasSameElements: #(exampleError) + hasSameElements: #(#testExampleError) ] @@ -36,7 +36,7 @@ BlTestOfExamplesTest >> testFail [ self assertCollection: (self examplesTestResult failures collect: [ :each | each selector ]) - hasSameElements: #(exampleFail) + hasSameElements: #(#testExampleFail) ] @@ -45,7 +45,7 @@ BlTestOfExamplesTest >> testPass [ self assertCollection: (self examplesTestResult passed collect: [ :each | each selector ]) - hasSameElements: #(examplePass) + hasSameElements: #(#testExamplePass) ] @@ -54,6 +54,6 @@ BlTestOfExamplesTest >> testSkip [ self assertCollection: (self examplesTestResult skipped collect: [ :each | each selector ]) - hasSameElements: #(exampleSkip) + hasSameElements: #(#testExampleSkip) ]