From 248555e4b517dbf2528700b04ab38adcee25f867 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Wed, 20 Nov 2019 16:31:03 +0100 Subject: [PATCH] Replace assert = in packages starting by S. Replace: - assert: = by assert: equals: - deny = by deny: equals: - assert: == by assert: identicalTo: - deny: == by deny: identicalTo: --- src/STON-Tests/STONJSONTest.class.st | 27 ++- src/STON-Tests/STONReaderTest.class.st | 162 +++++++++-------- src/STON-Tests/STONTest.class.st | 22 +-- src/STON-Tests/STONWriteReadTest.class.st | 13 +- src/STON-Tests/STONWriterTest.class.st | 165 +++++++++--------- .../ClassFactoryForTestCaseTest.class.st | 28 ++- .../ClassFactoryWithOrganizationTest.class.st | 30 ++-- src/SUnit-Tests/ExampleSetTest.class.st | 8 +- .../ResumableTestFailureTestCase.class.st | 4 +- src/SUnit-Tests/SUnitExtensionsTest.class.st | 20 +-- src/SUnit-Tests/SUnitTest.class.st | 4 +- src/SUnit-Tests/TestCaseTest.class.st | 24 +-- src/Slot-Tests/BooleanSlotTest.class.st | 52 ++---- src/Slot-Tests/PropertySlotTest.class.st | 28 ++- src/Slot-Tests/RelationSetTest.class.st | 3 +- src/Slot-Tests/RelationSlotTest.class.st | 5 +- src/Slot-Tests/SlotAnnouncementsTest.class.st | 15 +- src/Slot-Tests/SlotBasicTest.class.st | 9 +- src/Slot-Tests/SlotEnvironmentTest.class.st | 13 +- src/Slot-Tests/SlotIntegrationTest.class.st | 58 +++--- .../SlotMethodRecompilationTest.class.st | 17 +- src/Slot-Tests/SlotMigrationTest.class.st | 45 ++--- src/Slot-Tests/TemporaryVariableTest.class.st | 74 ++++---- ...UnlimitedInstanceVariableSlotTest.class.st | 27 ++- .../AbstractTwoButtonsTest.class.st | 4 +- .../ComposablePresenterWithModelTest.class.st | 110 +++++------- src/Spec-Tests/ListPresenterTest.class.st | 4 +- src/Spec-Tests/RGBSlidersTest.class.st | 30 ++-- .../RadioButtonGroupPresenterTest.class.st | 20 +-- src/Spec-Tests/SliderPresenterTest.class.st | 4 +- src/Spec-Tests/SpecFocusOrderTest.class.st | 2 +- src/Spec-Tests/SpecInterpreterTest.class.st | 31 ++-- src/Spec-Tests/TabPresenterTest.class.st | 6 +- .../SpAbstractTwoButtonsTest.class.st | 4 +- ...pComposablePresenterWithModelTest.class.st | 91 ++++------ src/Spec2-Tests/SpInterpreterTest.class.st | 2 +- .../SpSliderPresenterTest.class.st | 4 +- .../GlobalIdentifierMergerTest.class.st | 42 ++--- .../GlobalIdentifierTest.class.st | 40 +++-- .../SystemDictionaryTest.class.st | 30 ++-- .../SystemNavigationTest.class.st | 24 ++- .../SystemOrganizerTest.class.st | 7 +- 42 files changed, 606 insertions(+), 702 deletions(-) diff --git a/src/STON-Tests/STONJSONTest.class.st b/src/STON-Tests/STONJSONTest.class.st index 95ef02ba9c6..868831dbae7 100644 --- a/src/STON-Tests/STONJSONTest.class.st +++ b/src/STON-Tests/STONJSONTest.class.st @@ -79,31 +79,26 @@ STONJSONTest >> testNull [ { #category : #tests } STONJSONTest >> testOrderedDictionary [ | odictClass odict json dict | - odictClass := Smalltalk at: #OrderedDictionary ifAbsent: [ ^ self skip ]. - - odict := odictClass newFrom: { - 'a' -> 42 . 'b' -> 1. 'aa' -> 4. 'c' -> 23 - }. - - "assert that the order is not equal in the dictionary hash table". - self - assertCollection: odict asArray - hasSameElements: odict dictionary asArray; - deny: odict asArray = odict dictionary asArray. - + + odict := odictClass newFrom: {('a' -> 42) . ('b' -> 1) . ('aa' -> 4) . ('c' -> 23)}. + + "assert that the order is not equal in the dictionary hash table" + self + assertCollection: odict asArray hasSameElements: odict dictionary asArray; + deny: odict asArray equals: odict dictionary asArray. + "ordered presevered when encoding:" json := STONJSON toString: odict. self assert: json equals: '{"a":42,"b":1,"aa":4,"c":23}'. - + "lost when decoding" dict := STONJSON fromString: json. - self + self assertCollection: dict asArray hasSameElements: odict asArray; assert: dict equals: odict dictionary; - deny: dict asArray = odict asArray - + deny: dict asArray equals: odict asArray ] { #category : #tests } diff --git a/src/STON-Tests/STONReaderTest.class.st b/src/STON-Tests/STONReaderTest.class.st index 90e79c58094..44b39a0d40a 100644 --- a/src/STON-Tests/STONReaderTest.class.st +++ b/src/STON-Tests/STONReaderTest.class.st @@ -17,18 +17,17 @@ STONReaderTest >> materialize: string [ { #category : #tests } STONReaderTest >> testAssociation [ - self assert: (self materialize: '''foo'':1') = ('foo' -> 1). - self assert: (self materialize: '#bar:2') = (#bar -> 2). - self assert: (self materialize: '''foo bar'':#ok') = ('foo bar' -> #ok). - self assert: (self materialize: '123:456') = (123 -> 456). - - self assert: (self materialize: '''foo'' : 1') = ('foo' -> 1). - self assert: (self materialize: '#bar : 2') = (#bar -> 2). - self assert: (self materialize: '''foo bar'' : #ok') = ('foo bar' -> #ok). - self assert: (self materialize: '123 : -456') = (123 -> -456). - - self assert: (self materialize: '#foo : 1 : 2') = (#foo -> (1 -> 2)) + self assert: (self materialize: '''foo'':1') equals: 'foo' -> 1. + self assert: (self materialize: '#bar:2') equals: #bar -> 2. + self assert: (self materialize: '''foo bar'':#ok') equals: 'foo bar' -> #ok. + self assert: (self materialize: '123:456') equals: 123 -> 456. + + self assert: (self materialize: '''foo'' : 1') equals: 'foo' -> 1. + self assert: (self materialize: '#bar : 2') equals: #bar -> 2. + self assert: (self materialize: '''foo bar'' : #ok') equals: 'foo bar' -> #ok. + self assert: (self materialize: '123 : -456') equals: 123 -> -456. + self assert: (self materialize: '#foo : 1 : 2') equals: #foo -> (1 -> 2) ] { #category : #tests } @@ -50,13 +49,12 @@ STONReaderTest >> testBoolean [ { #category : #tests } STONReaderTest >> testByteArray [ - self assert: (self materialize: 'ByteArray[''010203'']') = #(1 2 3) asByteArray - + self assert: (self materialize: 'ByteArray[''010203'']') equals: #(1 2 3) asByteArray ] { #category : #tests } STONReaderTest >> testCharacter [ - self assert: (self materialize: 'Character[''A'']') == $A. + self assert: (self materialize: 'Character[''A'']') identicalTo: $A ] { #category : #tests } @@ -130,8 +128,15 @@ STONReaderTest >> testDate [ { #category : #tests } STONReaderTest >> testDateAndTime [ | dateAndTime | - dateAndTime := DateAndTime year: 2012 month: 1 day: 1 hour: 6 minute: 30 second: 15 offset: 1 hour. - self assert: (self materialize: 'DateAndTime[''2012-01-01T06:30:15+01:00'']') = dateAndTime + dateAndTime := DateAndTime + year: 2012 + month: 1 + day: 1 + hour: 6 + minute: 30 + second: 15 + offset: 1 hour. + self assert: (self materialize: 'DateAndTime[''2012-01-01T06:30:15+01:00'']') equals: dateAndTime ] { #category : #tests } @@ -154,19 +159,24 @@ STONReaderTest >> testDeepStructure [ { #category : #tests } STONReaderTest >> testDictionary [ | collection | - collection := STON mapClass new at: 1 put: 1; at: 2 put: 2; yourself. - self assert: (self materialize: '{1:1,2:2}') = collection. - self assert: (self materialize: '{}') = STON mapClass new. - + collection := STON mapClass new + at: 1 put: 1; + at: 2 put: 2; + yourself. + self assert: (self materialize: '{1:1,2:2}') equals: collection. + self assert: (self materialize: '{}') equals: STON mapClass new ] { #category : #tests } STONReaderTest >> testDictionaryWithComplexKeys [ | collection reader | - collection := STON mapClass new at: true put: 1; at: #(foo) put: 2; yourself. + collection := STON mapClass new + at: true put: 1; + at: #(foo) put: 2; + yourself. "allowing complex map keys used to be optional, now it is always the default" reader := STONReader on: '{true:1,[#foo]:2}' readStream. - self assert: reader next = collection + self assert: reader next equals: collection ] { #category : #tests } @@ -241,10 +251,12 @@ STONReaderTest >> testFraction [ { #category : #tests } STONReaderTest >> testIdentityDictionary [ | collection | - collection := IdentityDictionary new at: 1 put: 1; at: 2 put: 2; yourself. - self assert: (self materialize: 'IdentityDictionary{1:1,2:2}') = collection. - self assert: (self materialize: 'IdentityDictionary{}') = IdentityDictionary new. - + collection := IdentityDictionary new + at: 1 put: 1; + at: 2 put: 2; + yourself. + self assert: (self materialize: 'IdentityDictionary{1:1,2:2}') equals: collection. + self assert: (self materialize: 'IdentityDictionary{}') equals: IdentityDictionary new ] { #category : #tests } @@ -258,38 +270,41 @@ STONReaderTest >> testIllegalCharacterEscapes [ { #category : #tests } STONReaderTest >> testInteger [ - self assert: (self materialize: '1') = 1. - self assert: (self materialize: '-1') = -1. - self assert: (self materialize: '0') = 0. - self assert: (self materialize: '1234567890') = 1234567890. - self assert: (self materialize: '-1234567890') = -1234567890 + self assert: (self materialize: '1') equals: 1. + self assert: (self materialize: '-1') equals: -1. + self assert: (self materialize: '0') equals: 0. + self assert: (self materialize: '1234567890') equals: 1234567890. + self assert: (self materialize: '-1234567890') equals: -1234567890 ] { #category : #tests } STONReaderTest >> testJsonString [ "Allow double quotes for backwards JSON compatibility" - - | string | - self assert: (self materialize: '"foo"') = 'foo'. - self assert: (self materialize: '"FOO"') = 'FOO'. - self assert: (self materialize: '"\u00E9l\u00E8ve en Fran\u00E7ais"') = 'élève en Français'. - string := String withAll: { - $". $'. $\. Character tab. Character cr. Character lf. Character newPage. Character backspace }. - self assert: (self materialize: '"\"\''\\\t\r\n\f\b"') = string. + | string | + self assert: (self materialize: '"foo"') equals: 'foo'. + self assert: (self materialize: '"FOO"') equals: 'FOO'. + self assert: (self materialize: '"\u00E9l\u00E8ve en Fran\u00E7ais"') equals: 'élève en Français'. + string := String withAll: {$" . $' . $\ . Character tab . Character cr . Character lf . Character newPage . Character backspace}. + self assert: (self materialize: '"\"\''\\\t\r\n\f\b"') equals: string ] { #category : #tests } STONReaderTest >> testList [ - self assert: STON listClass = Array. - self assert: (self materialize: '[1,2,3]') = (STON listClass with: 1 with: 2 with: 3). - self assert: (self materialize: '[]') = STON listClass new + self assert: STON listClass equals: Array. + self assert: (self materialize: '[1,2,3]') equals: (STON listClass with: 1 with: 2 with: 3). + self assert: (self materialize: '[]') equals: STON listClass new ] { #category : #tests } STONReaderTest >> testMap [ - self assert: (self materialize: '{#foo:1}') = (STON mapClass new at: #foo put: 1; yourself). - self assert: (self materialize: '{}') = STON mapClass new + self + assert: (self materialize: '{#foo:1}') + equals: + (STON mapClass new + at: #foo put: 1; + yourself). + self assert: (self materialize: '{}') equals: STON mapClass new ] { #category : #tests } @@ -361,41 +376,41 @@ STONReaderTest >> testNull [ { #category : #tests } STONReaderTest >> testObject [ - self assert: (self materialize: 'Point[1,2]') = (1@2). - self assert: (self materialize: 'Point[1.5,-0.5]') = (1.5 @ -0.5). + self assert: (self materialize: 'Point[1,2]') equals: 1 @ 2. + self assert: (self materialize: 'Point[1.5,-0.5]') equals: 1.5 @ -0.5 ] { #category : #tests } STONReaderTest >> testOrderedCollection [ | collection | collection := OrderedCollection with: 1 with: 2 with: 3. - self assert: (self materialize: 'OrderedCollection[1,2,3]') = collection. - self assert: (self materialize: 'OrderedCollection[]') = OrderedCollection new. + self assert: (self materialize: 'OrderedCollection[1,2,3]') equals: collection. + self assert: (self materialize: 'OrderedCollection[]') equals: OrderedCollection new ] { #category : #tests } STONReaderTest >> testPoint [ - self assert: (self materialize: 'Point[1,2]') = (1@2) + self assert: (self materialize: 'Point[1,2]') equals: 1 @ 2 ] { #category : #tests } STONReaderTest >> testReferenceCycle [ | array | - array := (self materialize: '[1,@1]'). - self assert: array class = STON listClass. - self assert: array size = 2. - self assert: array first = 1. - self assert: array second == array + array := self materialize: '[1,@1]'. + self assert: array class equals: STON listClass. + self assert: array size equals: 2. + self assert: array first equals: 1. + self assert: array second identicalTo: array ] { #category : #tests } STONReaderTest >> testReferenceSharing [ | one array | - one := { #one }. - array := (self materialize: '[[#one],@2,@2]'). - self assert: array = (STON listClass with: one with: one with: one). - self assert: array first == array second. - self assert: array first == array third + one := {#one}. + array := self materialize: '[[#one],@2,@2]'. + self assert: array equals: (STON listClass with: one with: one with: one). + self assert: array first identicalTo: array second. + self assert: array first identicalTo: array third ] { #category : #tests } @@ -450,19 +465,17 @@ STONReaderTest >> testStreaming [ { #category : #tests } STONReaderTest >> testString [ | string | - self assert: (self materialize: '''foo''') = 'foo'. - self assert: (self materialize: '''FOO''') = 'FOO'. - self assert: (self materialize: '''\u00E9l\u00E8ve en Fran\u00E7ais''') = 'élève en Français'. - string := String withAll: { - $". $'. $\. $/. Character tab. Character cr. Character lf. Character newPage. Character backspace }. - self assert: (self materialize: '''\"\''\\\/\t\r\n\f\b''') = string. - + self assert: (self materialize: '''foo''') equals: 'foo'. + self assert: (self materialize: '''FOO''') equals: 'FOO'. + self assert: (self materialize: '''\u00E9l\u00E8ve en Fran\u00E7ais''') equals: 'élève en Français'. + string := String withAll: {$" . $' . $\ . $/ . Character tab . Character cr . Character lf . Character newPage . Character backspace}. + self assert: (self materialize: '''\"\''\\\/\t\r\n\f\b''') equals: string ] { #category : #tests } STONReaderTest >> testSymbol [ - self assert: (self materialize: '#''foo''') = #foo. - self assert: (self materialize: '#foo') = #foo + self assert: (self materialize: '#''foo''') equals: #foo. + self assert: (self materialize: '#foo') equals: #foo ] { #category : #tests } @@ -512,7 +525,7 @@ STONReaderTest >> testUser [ (user := STONTestUser new) username: 'john@foo.com'; password: 'secret1'. - self assert: (self materialize: 'STONTestUser{#username:''john@foo.com'',#password:''secret1'',#enabled:true}') = user + self assert: (self materialize: 'STONTestUser{#username:''john@foo.com'',#password:''secret1'',#enabled:true}') equals: user ] { #category : #tests } @@ -521,19 +534,18 @@ STONReaderTest >> testUser2 [ (user := STONTestUser2 new) username: 'john@foo.com'; password: 'secret1'. - self assert: (self materialize: 'STONTestUser2{#username:''john@foo.com'',#password:''secret1'',#enabled:true}') = user + self assert: (self materialize: 'STONTestUser2{#username:''john@foo.com'',#password:''secret1'',#enabled:true}') equals: user ] { #category : #tests } STONReaderTest >> testWhitespace [ | whitespace | - whitespace := { Character space. Character tab. Character cr. Character lf }. - self assert: (self materialize: whitespace, '123') = 123 - + whitespace := {Character space . Character tab . Character cr . Character lf}. + self assert: (self materialize: whitespace , '123') equals: 123 ] { #category : #tests } STONReaderTest >> testWideSymbol [ - self assert: (self materialize: '#''яблоко''') = #яблоко. - self assert: (self materialize: '#яблоко') = #яблоко + self assert: (self materialize: '#''яблоко''') equals: #яблоко. + self assert: (self materialize: '#яблоко') equals: #яблоко ] diff --git a/src/STON-Tests/STONTest.class.st b/src/STON-Tests/STONTest.class.st index bbf9155d1a3..81acde8bac4 100644 --- a/src/STON-Tests/STONTest.class.st +++ b/src/STON-Tests/STONTest.class.st @@ -52,8 +52,8 @@ STONTest class >> write: object toFileNamed: path [ { #category : #tests } STONTest >> testFromString [ | object | - object := STON listClass withAll: { 1. 0. -1. true. false. nil }. - self assert: (STON fromString: '[1,0,-1,true,false,nil]') = object + object := STON listClass withAll: {1 . 0 . -1 . true . false . nil}. + self assert: (STON fromString: '[1,0,-1,true,false,nil]') equals: object ] { #category : #tests } @@ -69,9 +69,9 @@ STONTest >> testFromStringWithComments [ STONTest >> testPrettyPrinting [ | object | object := STONTestUser dummy. - self assert: (STON fromString: (STON toStringPretty: object)) = object. + self assert: (STON fromString: (STON toStringPretty: object)) equals: object. object := STONTestDomainObject dummy. - self assert: (STON fromString: (STON toStringPretty: object)) = object + self assert: (STON fromString: (STON toStringPretty: object)) equals: object ] { #category : #tests } @@ -97,17 +97,17 @@ STONTest >> testRoomExitCycles [ self assert: (object second at: #name) equals: 'Room 2'. self assert: ((object first at: #exit) at: #name) equals: 'Exit 1'. self assert: ((object second at: #exit) at: #name) equals: 'Exit 2'. - self assert: ((object first at: #exit) at: #origin) == object first. - self assert: ((object first at: #exit) at: #destination) == object second. - self assert: ((object second at: #exit) at: #origin) == object second. - self assert: ((object second at: #exit) at: #destination) == object first. - "Try writing again the parse model" + self assert: ((object first at: #exit) at: #origin) identicalTo: object first. + self assert: ((object first at: #exit) at: #destination) identicalTo: object second. + self assert: ((object second at: #exit) at: #origin) identicalTo: object second. + self assert: ((object second at: #exit) at: #destination) identicalTo: object first. + "Try writing again the parse model" self assert: (STON toString: object) equals: ston ] { #category : #tests } STONTest >> testToString [ | object | - object := STON listClass withAll: { 1. 0. -1. true. false. nil }. - self assert: (STON toString: object) = '[1,0,-1,true,false,nil]' + object := STON listClass withAll: {1 . 0 . -1 . true . false . nil}. + self assert: (STON toString: object) equals: '[1,0,-1,true,false,nil]' ] diff --git a/src/STON-Tests/STONWriteReadTest.class.st b/src/STON-Tests/STONWriteReadTest.class.st index 752814ae7b8..19e6c2aba06 100644 --- a/src/STON-Tests/STONWriteReadTest.class.st +++ b/src/STON-Tests/STONWriteReadTest.class.st @@ -197,8 +197,9 @@ STONWriteReadTest >> testFloats [ floats := STON listClass withAll: ((-10 to: 10) collect: [ :each | each * Float pi ]). serialization := self serialize: floats. materialization := self materialize: serialization. - self assert: floats size = materialization size. - 1 to: floats size do: [:index | | float | + self assert: floats size equals: materialization size. + 1 to: floats size do: [ :index | + | float | float := floats at: index. "Use #closeTo: instead of #= to increase portability" self assert: (float closeTo: (materialization at: index)) ] @@ -255,17 +256,17 @@ STONWriteReadTest >> testKnownObjects [ knownObject := STONTestKnownObject new. "make sure the system of remembering instances works" self assert: (STONTestKnownObject fromId: knownObject id asString) equals: knownObject. - self assert: (STONTestKnownObject fromId: knownObject id asString) == knownObject. + self assert: (STONTestKnownObject fromId: knownObject id asString) identicalTo: knownObject. "only the id string is serialized" ston := self serialize: knownObject. "upon serialization, objects with known id strings come from the remembered instances" object := self materialize: ston. self assert: object equals: knownObject. - self assert: object == knownObject. + self assert: object identicalTo: knownObject. "not just the id is equal, but the rest of the object too" self assert: object description equals: knownObject description. - - STONTestKnownObject resetKnownObjects. + + STONTestKnownObject resetKnownObjects ] { #category : #tests } diff --git a/src/STON-Tests/STONWriterTest.class.st b/src/STON-Tests/STONWriterTest.class.st index ed2f896a752..f869db5cf9a 100644 --- a/src/STON-Tests/STONWriterTest.class.st +++ b/src/STON-Tests/STONWriterTest.class.st @@ -43,11 +43,10 @@ STONWriterTest >> serializePretty: anObject [ { #category : #tests } STONWriterTest >> testAssociation [ - self assert: (self serialize: 'foo' -> 1) = '''foo'':1'. - self assert: (self serialize: #bar -> 2) = '#bar:2'. - self assert: (self serialize: 'foo bar' -> #ok) = '''foo bar'':#ok'. - self assert: (self serialize: 123 -> 456) = '123:456' - + self assert: (self serialize: 'foo' -> 1) equals: '''foo'':1'. + self assert: (self serialize: #bar -> 2) equals: '#bar:2'. + self assert: (self serialize: 'foo bar' -> #ok) equals: '''foo bar'':#ok'. + self assert: (self serialize: 123 -> 456) equals: '123:456' ] { #category : #tests } @@ -63,19 +62,18 @@ STONWriterTest >> testBag [ { #category : #tests } STONWriterTest >> testBoolean [ - self assert: (self serialize: true) = 'true'. - self assert: (self serialize: false) = 'false' + self assert: (self serialize: true) equals: 'true'. + self assert: (self serialize: false) equals: 'false' ] { #category : #tests } STONWriterTest >> testByteArray [ - self assert: (self serialize: #(1 2 3) asByteArray) = 'ByteArray[''010203'']' - + self assert: (self serialize: #(1 2 3) asByteArray) equals: 'ByteArray[''010203'']' ] { #category : #tests } STONWriterTest >> testClass [ - self assert: (self serialize: Point) = 'Class[#Point]' + self assert: (self serialize: Point) equals: 'Class[#Point]' ] { #category : #tests } @@ -117,16 +115,26 @@ STONWriterTest >> testDate [ { #category : #tests } STONWriterTest >> testDateAndTime [ | dateAndTime | - dateAndTime := DateAndTime year: 2012 month: 1 day: 1 hour: 6 minute: 30 second: 15 offset: 1 hour. - self assert: (self serialize: dateAndTime) = 'DateAndTime[''2012-01-01T06:30:15+01:00'']' + dateAndTime := DateAndTime + year: 2012 + month: 1 + day: 1 + hour: 6 + minute: 30 + second: 15 + offset: 1 hour. + self assert: (self serialize: dateAndTime) equals: 'DateAndTime[''2012-01-01T06:30:15+01:00'']' ] { #category : #tests } STONWriterTest >> testDictionary [ | collection | - collection := STON mapClass new at: 1 put: 1; at: 2 put: 2; yourself. - self assert: (self serialize: collection) = '{1:1,2:2}'. - self assert: (self serialize: STON mapClass new) = '{}'. + collection := STON mapClass new + at: 1 put: 1; + at: 2 put: 2; + yourself. + self assert: (self serialize: collection) equals: '{1:1,2:2}'. + self assert: (self serialize: STON mapClass new) equals: '{}' ] { #category : #tests } @@ -148,14 +156,12 @@ STONWriterTest >> testDiskFile [ { #category : #tests } STONWriterTest >> testDoubleQuotedString [ | string | - self assert: (self serializeJson: 'foo') = '"foo"'. - self assert: (self serializeJson: 'FOO') = '"FOO"'. - self assert: (self serializeJson: 'élève en Français') = '"élève en Français"'. - string := String withAll: { - $". $'. $\. $/. Character tab. Character cr. Character lf. Character newPage. Character backspace }. + self assert: (self serializeJson: 'foo') equals: '"foo"'. + self assert: (self serializeJson: 'FOO') equals: '"FOO"'. + self assert: (self serializeJson: 'élève en Français') equals: '"élève en Français"'. + string := String withAll: {$" . $' . $\ . $/ . Character tab . Character cr . Character lf . Character newPage . Character backspace}. "Note that in JSON mode, double quotes get escaped, and single quotes not" - self assert: (self serializeJson: string) equals: '"\"''\\/\t\r\n\f\b"'. - + self assert: (self serializeJson: string) equals: '"\"''\\/\t\r\n\f\b"' ] { #category : #tests } @@ -170,14 +176,14 @@ STONWriterTest >> testEmptyDictionaryPretty [ { #category : #tests } STONWriterTest >> testFloat [ - self assert: (self serialize: 1.5) = '1.5'. - self assert: (self serialize: 0.0) = '0.0'. - self assert: (self serialize: -1.5) = '-1.5'. - self assert: ((self serialize: Float pi) beginsWith: '3.14159'). - self assert: ((self serialize: (1/3) asFloat) beginsWith: '0.333'). - self assert: (self serialize: (10 raisedTo: 100) asFloat) = '1.0e100'. - self assert: (self serialize: (10 raisedTo: -50) asFloat) = '1.0e-50'. - self assert: (self serialize: (10 raisedTo: -50) asFloat negated) = '-1.0e-50'. + self assert: (self serialize: 1.5) equals: '1.5'. + self assert: (self serialize: 0.0) equals: '0.0'. + self assert: (self serialize: -1.5) equals: '-1.5'. + self assert: ((self serialize: Float pi) beginsWith: '3.14159'). + self assert: ((self serialize: (1 / 3) asFloat) beginsWith: '0.333'). + self assert: (self serialize: (10 raisedTo: 100) asFloat) equals: '1.0e100'. + self assert: (self serialize: (10 raisedTo: -50) asFloat) equals: '1.0e-50'. + self assert: (self serialize: (10 raisedTo: -50) asFloat negated) equals: '-1.0e-50' ] { #category : #tests } @@ -193,18 +199,21 @@ STONWriterTest >> testFraction [ { #category : #tests } STONWriterTest >> testIdentityDictionary [ | collection | - collection := IdentityDictionary new at: 1 put: 1; at: 2 put: 2; yourself. - self assert: (self serialize: collection) = 'IdentityDictionary{1:1,2:2}'. - self assert: (self serialize: IdentityDictionary new) = 'IdentityDictionary{}'. + collection := IdentityDictionary new + at: 1 put: 1; + at: 2 put: 2; + yourself. + self assert: (self serialize: collection) equals: 'IdentityDictionary{1:1,2:2}'. + self assert: (self serialize: IdentityDictionary new) equals: 'IdentityDictionary{}' ] { #category : #tests } STONWriterTest >> testInteger [ - self assert: (self serialize: 1) = '1'. - self assert: (self serialize: 0) = '0'. - self assert: (self serialize: -1) = '-1'. - self assert: (self serialize: 1234567890) = '1234567890'. - self assert: (self serialize: -1234567890) = '-1234567890' + self assert: (self serialize: 1) equals: '1'. + self assert: (self serialize: 0) equals: '0'. + self assert: (self serialize: -1) equals: '-1'. + self assert: (self serialize: 1234567890) equals: '1234567890'. + self assert: (self serialize: -1234567890) equals: '-1234567890' ] { #category : #tests } @@ -244,9 +253,9 @@ STONWriterTest >> testKeepingNewLines [ { #category : #tests } STONWriterTest >> testList [ - self assert: (self serialize: (STON listClass withAll: #(1 2 3))) = '[1,2,3]'. - self assert: (self serialize: STON listClass new) = '[]'. - self assert: (self serialize: (STON listClass withAll: { 1. -1. 0. #foo. 'a b c'. true. false. nil })) = '[1,-1,0,#foo,''a b c'',true,false,nil]' + self assert: (self serialize: (STON listClass withAll: #(1 2 3))) equals: '[1,2,3]'. + self assert: (self serialize: STON listClass new) equals: '[]'. + self assert: (self serialize: (STON listClass withAll: {1 . -1 . 0 . #foo . 'a b c' . true . false . nil})) equals: '[1,-1,0,#foo,''a b c'',true,false,nil]' ] { #category : #tests } @@ -255,21 +264,19 @@ STONWriterTest >> testMap [ (map := STON mapClass new) at: #foo put: 1; at: #bar put: 2. - self assert: (self serialize: map) = '{#foo:1,#bar:2}'. - self assert: (self serialize: STON mapClass new) = '{}'. + self assert: (self serialize: map) equals: '{#foo:1,#bar:2}'. + self assert: (self serialize: STON mapClass new) equals: '{}'. map removeAll. map at: 'foo bar' put: #ok. - self assert: (self serialize: map) = '{''foo bar'':#ok}'. + self assert: (self serialize: map) equals: '{''foo bar'':#ok}'. map removeAll. map at: 123 put: 456. - self assert: (self serialize: map) = '{123:456}'. - - + self assert: (self serialize: map) equals: '{123:456}' ] { #category : #tests } STONWriterTest >> testMetaclass [ - self assert: (self serialize: Point class) = 'Metaclass[#Point]' + self assert: (self serialize: Point class) equals: 'Metaclass[#Point]' ] { #category : #tests } @@ -284,7 +291,7 @@ STONWriterTest >> testMimeType [ { #category : #tests } STONWriterTest >> testNil [ - self assert: (self serialize: nil) = 'nil' + self assert: (self serialize: nil) equals: 'nil' ] { #category : #tests } @@ -307,13 +314,13 @@ STONWriterTest >> testNull [ STONWriterTest >> testOrderedCollection [ | collection | collection := OrderedCollection with: 1 with: 2 with: 3. - self assert: (self serialize: collection) = 'OrderedCollection[1,2,3]'. - self assert: (self serialize: OrderedCollection new) = 'OrderedCollection[]'. + self assert: (self serialize: collection) equals: 'OrderedCollection[1,2,3]'. + self assert: (self serialize: OrderedCollection new) equals: 'OrderedCollection[]' ] { #category : #tests } STONWriterTest >> testPoint [ - self assert: (self serialize: 1@2) = 'Point[1,2]' + self assert: (self serialize: 1 @ 2) equals: 'Point[1,2]' ] { #category : #tests } @@ -321,15 +328,15 @@ STONWriterTest >> testReferenceCycle [ | array | array := STON listClass with: 1 with: nil. array at: 2 put: array. - self assert: (self serialize: array) = '[1,@1]'. + self assert: (self serialize: array) equals: '[1,@1]' ] { #category : #tests } STONWriterTest >> testReferenceSharing [ | array one | - one := { #one }. + one := {#one}. array := STON listClass with: one with: one with: one. - self assert: (self serialize: array) = '[[#one],@2,@2]'. + self assert: (self serialize: array) equals: '[[#one],@2,@2]' ] { #category : #tests } @@ -353,14 +360,15 @@ STONWriterTest >> testReferenceSharingError [ STONWriterTest >> testReferenceSharingIgnore [ | serializer array one | serializer := [ :object | - String streamContents: [ :stream | - STON writer + String + streamContents: [ :stream | + STON writer on: stream; - referencePolicy: #ignore; + referencePolicy: #ignore; nextPut: object ] ]. - one := { #one }. + one := {#one}. array := STON listClass with: one with: one with: one. - self assert: (serializer value: array) = '[[#one],[#one],[#one]]'. + self assert: (serializer value: array) equals: '[[#one],[#one],[#one]]' ] { #category : #tests } @@ -382,34 +390,31 @@ STONWriterTest >> testScaledDecimal [ { #category : #tests } STONWriterTest >> testString [ | string | - self assert: (self serialize: 'foo') = '''foo'''. - self assert: (self serialize: 'FOO') = '''FOO'''. - self assert: (self serializeAsciiOnly: 'élève en Français') = '''\u00E9l\u00E8ve en Fran\u00E7ais'''. - self assert: (self serialize: 'élève en Français') = '''élève en Français'''. - string := String withAll: { - $". $'. $\. $/. Character tab. Character cr. Character lf. Character newPage. Character backspace }. - self assert: (self serialize: string) equals: '''"\''\\/\t\r\n\f\b'''. - + self assert: (self serialize: 'foo') equals: '''foo'''. + self assert: (self serialize: 'FOO') equals: '''FOO'''. + self assert: (self serializeAsciiOnly: 'élève en Français') equals: '''\u00E9l\u00E8ve en Fran\u00E7ais'''. + self assert: (self serialize: 'élève en Français') equals: '''élève en Français'''. + string := String withAll: {$" . $' . $\ . $/ . Character tab . Character cr . Character lf . Character newPage . Character backspace}. + self assert: (self serialize: string) equals: '''"\''\\/\t\r\n\f\b''' ] { #category : #tests } STONWriterTest >> testSymbol [ - self assert: (self serialize: #foo) = '#foo'. - self assert: (self serialize: #FOO) = '#FOO'. - self assert: (self serialize: #bytes) = '#bytes'. - self assert: (self serialize: #'foo.bar') = '#foo.bar'. - self assert: (self serialize: #'foo-bar') = '#foo-bar'. - self assert: (self serialize: #'foo_bar') = '#foo_bar'. - self assert: (self serialize: #'foo/bar') = '#foo/bar'. - self assert: (self serialize: #'foo bar') = '#''foo bar'''. - self assert: (self serialize: #foo123) = '#foo123'. + self assert: (self serialize: #foo) equals: '#foo'. + self assert: (self serialize: #FOO) equals: '#FOO'. + self assert: (self serialize: #bytes) equals: '#bytes'. + self assert: (self serialize: #'foo.bar') equals: '#foo.bar'. + self assert: (self serialize: #'foo-bar') equals: '#foo-bar'. + self assert: (self serialize: #foo_bar) equals: '#foo_bar'. + self assert: (self serialize: #'foo/bar') equals: '#foo/bar'. + self assert: (self serialize: #'foo bar') equals: '#''foo bar'''. + self assert: (self serialize: #foo123) equals: '#foo123' ] { #category : #tests } STONWriterTest >> testSymbolAsString [ - self assert: (self serializeJson: #foo) = '"foo"'. - self assert: (self serializeJson: #'FOO') = '"FOO"'. - + self assert: (self serializeJson: #foo) equals: '"foo"'. + self assert: (self serializeJson: #FOO) equals: '"FOO"' ] { #category : #tests } diff --git a/src/SUnit-Tests/ClassFactoryForTestCaseTest.class.st b/src/SUnit-Tests/ClassFactoryForTestCaseTest.class.st index ec9f0584935..0db74627b70 100644 --- a/src/SUnit-Tests/ClassFactoryForTestCaseTest.class.st +++ b/src/SUnit-Tests/ClassFactoryForTestCaseTest.class.st @@ -103,11 +103,10 @@ ClassFactoryForTestCaseTest >> testDuplicateClassWithNewName [ { #category : #testing } ClassFactoryForTestCaseTest >> testMultipleClassCreation [ - 5 timesRepeat: [ - factory newClass]. + 5 timesRepeat: [ factory newClass ]. self assert: (SystemNavigation new allClasses includesAll: factory createdClasses). - self assert: factory createdClassNames asSet size = 5. - self assert: (SystemOrganization listAtCategoryNamed: factory defaultCategory) asSet = factory createdClassNames asSet + self assert: factory createdClassNames asSet size equals: 5. + self assert: (SystemOrganization listAtCategoryNamed: factory defaultCategory) asSet equals: factory createdClassNames asSet ] { #category : #testing } @@ -126,16 +125,13 @@ ClassFactoryForTestCaseTest >> testPackageCleanUp [ { #category : #testing } ClassFactoryForTestCaseTest >> testSingleClassCreation [ - |class elementsInCategoryForTest | - class := factory - newSubclassOf: Object - instanceVariableNames: 'a b c' - classVariableNames: 'X Y'. + | class elementsInCategoryForTest | + class := factory newSubclassOf: Object instanceVariableNames: 'a b c' classVariableNames: 'X Y'. self assert: (SystemNavigation new allClasses includes: class). - elementsInCategoryForTest := SystemOrganization listAtCategoryNamed: factory defaultCategory. - self assert: elementsInCategoryForTest = {class name}. - self assert: class instVarNames = #(a b c). - self assert: class classPool keys asSet = #(X Y) asSet + elementsInCategoryForTest := SystemOrganization listAtCategoryNamed: factory defaultCategory. + self assert: elementsInCategoryForTest equals: {class name}. + self assert: class instVarNames equals: #(a b c). + self assert: class classPool keys asSet equals: #(X Y) asSet ] { #category : #testing } @@ -144,7 +140,7 @@ ClassFactoryForTestCaseTest >> testSingleClassFastCreation [ class := factory newClass. self assert: (SystemNavigation new allClasses includes: class). elementsInCategoryForTest := SystemOrganization listAtCategoryNamed: factory defaultCategory. - self assert: elementsInCategoryForTest = {class name}. + self assert: elementsInCategoryForTest equals: {class name}. self assertEmpty: class instVarNames. self assertEmpty: class classPool ] @@ -154,8 +150,8 @@ ClassFactoryForTestCaseTest >> testSingleTraitCreation [ | trait | trait := factory newTrait. self assert: (testingEnvironment allTraits includes: trait). - self assert: trait traitUsers size = 0. - self assert: trait traits size = 0 + self assert: trait traitUsers size equals: 0. + self assert: trait traits size equals: 0 ] { #category : #testing } diff --git a/src/SUnit-Tests/ClassFactoryWithOrganizationTest.class.st b/src/SUnit-Tests/ClassFactoryWithOrganizationTest.class.st index 63f2ef8891c..a8cc1b8a770 100644 --- a/src/SUnit-Tests/ClassFactoryWithOrganizationTest.class.st +++ b/src/SUnit-Tests/ClassFactoryWithOrganizationTest.class.st @@ -77,13 +77,11 @@ ClassFactoryWithOrganizationTest >> testDefaultCategoryCleanUp [ { #category : #testing } ClassFactoryWithOrganizationTest >> testMultipleClassCreation [ - 5 timesRepeat: [ - factory newClass]. + 5 timesRepeat: [ factory newClass ]. self assert: (self testedEnvironment allClasses includesAll: factory createdClasses). - self assert: factory createdClassNames asSet size = 5. - self assert: (self testedOrganization listAtCategoryNamed: factory defaultCategory) asSet = factory createdClassNames asSet. - factory createdClasses do: [ :aClass | - self assertEnvironmentOf: aClass ] + self assert: factory createdClassNames asSet size equals: 5. + self assert: (self testedOrganization listAtCategoryNamed: factory defaultCategory) asSet equals: factory createdClassNames asSet. + factory createdClasses do: [ :aClass | self assertEnvironmentOf: aClass ] ] { #category : #testing } @@ -102,18 +100,14 @@ ClassFactoryWithOrganizationTest >> testPackageCleanUp [ { #category : #testing } ClassFactoryWithOrganizationTest >> testSingleClassCreation [ - |class elementsInCategoryForTest | - class := factory - newSubclassOf: Object - instanceVariableNames: 'a b c' - classVariableNames: 'X Y'. + | class elementsInCategoryForTest | + class := factory newSubclassOf: Object instanceVariableNames: 'a b c' classVariableNames: 'X Y'. self assert: (self testedEnvironment allClasses includes: class). - factory createdClasses do: [ :aClass | - self assertEnvironmentOf: aClass ]. - elementsInCategoryForTest := self testedOrganization listAtCategoryNamed: factory defaultCategory. - self assert: elementsInCategoryForTest = {class name}. - self assert: class instVarNames = #(a b c). - self assert: class classPool keys asSet = #(X Y) asSet + factory createdClasses do: [ :aClass | self assertEnvironmentOf: aClass ]. + elementsInCategoryForTest := self testedOrganization listAtCategoryNamed: factory defaultCategory. + self assert: elementsInCategoryForTest equals: {class name}. + self assert: class instVarNames equals: #(a b c). + self assert: class classPool keys asSet equals: #(X Y) asSet ] { #category : #testing } @@ -123,7 +117,7 @@ ClassFactoryWithOrganizationTest >> testSingleClassFastCreation [ self assert: (self testedEnvironment allClasses includes: class). elementsInCategoryForTest := self testedOrganization listAtCategoryNamed: factory defaultCategory. factory createdClasses do: [ :aClass | self assertEnvironmentOf: aClass ]. - self assert: elementsInCategoryForTest = {class name}. + self assert: elementsInCategoryForTest equals: {class name}. self assertEmpty: class instVarNames. self assertEmpty: class classPool ] diff --git a/src/SUnit-Tests/ExampleSetTest.class.st b/src/SUnit-Tests/ExampleSetTest.class.st index aba1a1844ff..2eef8ddbc68 100644 --- a/src/SUnit-Tests/ExampleSetTest.class.st +++ b/src/SUnit-Tests/ExampleSetTest.class.st @@ -27,7 +27,7 @@ ExampleSetTest >> testAdd [ { #category : #testing } ExampleSetTest >> testGrow [ empty addAll: (1 to: 100). - self assert: empty size = 100 + self assert: empty size equals: 100 ] { #category : #testing } @@ -48,10 +48,10 @@ ExampleSetTest >> testIncludes [ { #category : #testing } ExampleSetTest >> testOccurrences [ - self assert: (empty occurrencesOf: 0) = 0. - self assert: (full occurrencesOf: 5) = 1. + self assert: (empty occurrencesOf: 0) equals: 0. + self assert: (full occurrencesOf: 5) equals: 1. full add: 5. - self assert: (full occurrencesOf: 5) = 1 + self assert: (full occurrencesOf: 5) equals: 1 ] { #category : #testing } diff --git a/src/SUnit-Tests/ResumableTestFailureTestCase.class.st b/src/SUnit-Tests/ResumableTestFailureTestCase.class.st index 3b681de4fb1..9a702f5a82f 100644 --- a/src/SUnit-Tests/ResumableTestFailureTestCase.class.st +++ b/src/SUnit-Tests/ResumableTestFailureTestCase.class.st @@ -79,6 +79,6 @@ ResumableTestFailureTestCase >> testResumable [ suite addTest: (self class selector: #okTest). result := suite run. self - assert: result failures size = 2; - assert: result errors size = 1 + assert: result failures size equals: 2; + assert: result errors size equals: 1 ] diff --git a/src/SUnit-Tests/SUnitExtensionsTest.class.st b/src/SUnit-Tests/SUnitExtensionsTest.class.st index f859249cd0b..b8f73dec3dd 100644 --- a/src/SUnit-Tests/SUnitExtensionsTest.class.st +++ b/src/SUnit-Tests/SUnitExtensionsTest.class.st @@ -112,7 +112,7 @@ SUnitExtensionsTest >> testAssertionFailedInRaiseWithExceptionDo [ testResult := testCase run. self assert: (testResult failures includes: testCase). - self assert: testResult failures size = 1. + self assert: testResult failures size equals: 1. self assertEmpty: testResult passed. self assertEmpty: testResult errors ] @@ -156,7 +156,7 @@ SUnitExtensionsTest >> testDifferentExceptionInShouldRaiseWithExceptionDo [ self assert: (testResult passed includes: testCase). self assertEmpty: testResult errors. self assertEmpty: testResult failures. - self assert: testResult passed size = 1 + self assert: testResult passed size equals: 1 ] { #category : #test } @@ -166,7 +166,7 @@ SUnitExtensionsTest >> testErrorInRaiseWithExceptionDo [ testResult := testCase run. self assert: (testResult errors includes: testCase). - self assert: testResult errors size = 1. + self assert: testResult errors size equals: 1. self assertEmpty: testResult failures. self assertEmpty: testResult passed ] @@ -192,7 +192,7 @@ SUnitExtensionsTest >> testInvalidShouldNotTakeMoreThan [ testResult := testCase run. self assertEmpty: testResult passed. - self assert: testResult failures size = 1. + self assert: testResult failures size equals: 1. self assert: (testResult failures includes: testCase). self assertEmpty: testResult errors ] @@ -204,7 +204,7 @@ SUnitExtensionsTest >> testInvalidShouldNotTakeMoreThanMilliseconds [ testResult := testCase run. self assertEmpty: testResult passed. - self assert: testResult failures size = 1. + self assert: testResult failures size equals: 1. self assert: (testResult failures includes: testCase). self assertEmpty: testResult errors ] @@ -216,7 +216,7 @@ SUnitExtensionsTest >> testNoExceptionInShouldRaiseWithExceptionDo [ testResult := testCase run. self assert: (testResult failures includes: testCase). - self assert: testResult failures size = 1. + self assert: testResult failures size equals: 1. self assertEmpty: testResult passed. self assertEmpty: testResult errors ] @@ -246,7 +246,7 @@ SUnitExtensionsTest >> testShouldFix [ testResult := testCase run. self assert: (testResult passed includes: testCase). - self assert: testResult passed size = 1. + self assert: testResult passed size equals: 1. self assertEmpty: testResult failures. self assertEmpty: testResult errors ] @@ -258,7 +258,7 @@ SUnitExtensionsTest >> testShouldRaiseWithExceptionDo [ testResult := testCase run. self assert: (testResult passed includes: testCase). - self assert: testResult passed size = 1. + self assert: testResult passed size equals: 1. self assertEmpty: testResult failures. self assertEmpty: testResult errors ] @@ -270,7 +270,7 @@ SUnitExtensionsTest >> testValidShouldNotTakeMoreThan [ testResult := testCase run. self assert: (testResult passed includes: testCase). - self assert: testResult passed size = 1. + self assert: testResult passed size equals: 1. self assertEmpty: testResult failures. self assertEmpty: testResult errors ] @@ -282,7 +282,7 @@ SUnitExtensionsTest >> testValidShouldNotTakeMoreThanMilliseconds [ testResult := testCase run. self assert: (testResult passed includes: testCase). - self assert: testResult passed size = 1. + self assert: testResult passed size equals: 1. self assertEmpty: testResult failures. self assertEmpty: testResult errors ] diff --git a/src/SUnit-Tests/SUnitTest.class.st b/src/SUnit-Tests/SUnitTest.class.st index 8811f78e346..229b9dc8b18 100644 --- a/src/SUnit-Tests/SUnitTest.class.st +++ b/src/SUnit-Tests/SUnitTest.class.st @@ -186,7 +186,7 @@ SUnitTest >> testDefects [ suite addTest: (error := self class selector: #error). suite addTest: (failure := self class selector: #fail). result := suite run. - self assert: result defects asArray = (Array with: error with: failure). + self assert: result defects asArray equals: (Array with: error with: failure). self assertForTestResult: result runCount: 2 @@ -285,7 +285,7 @@ SUnitTest >> testExpectedFailure [ { #category : #testing } SUnitTest >> testExpectedFailureDetection [ - self assert: self expectedFailures size = 2. + self assert: self expectedFailures size equals: 2. self assert: (self expectedFailures includesAll: #(expectedFailureFails expectedFailurePasses)) ] diff --git a/src/SUnit-Tests/TestCaseTest.class.st b/src/SUnit-Tests/TestCaseTest.class.st index 42078edd156..7d76e748483 100644 --- a/src/SUnit-Tests/TestCaseTest.class.st +++ b/src/SUnit-Tests/TestCaseTest.class.st @@ -13,29 +13,29 @@ TestCaseTest >> testAnnouncement [ unitTest := ClassFactoryForTestCaseTest. collection := OrderedCollection new. unitTest resetAnnouncer. - - self deny: (unitTest shouldAnnounce). - self deny: (unitTest new shouldAnnounce). - - unitTest announcer when: TestCaseAnnouncement do: [:ann | collection add: ann ]. - self assert: (unitTest shouldAnnounce). - self assert: (unitTest new shouldAnnounce). + self deny: unitTest shouldAnnounce. + self deny: unitTest new shouldAnnounce. + + unitTest announcer when: TestCaseAnnouncement do: [ :ann | collection add: ann ]. + + self assert: unitTest shouldAnnounce. + self assert: unitTest new shouldAnnounce. "We run SUnitTest" suite := unitTest buildSuite. suite run. - self assert: (collection size = (suite tests size * 2)). - self assert: (collection select: [:c | c isKindOf: TestCaseStarted]) size = (collection size / 2). - self assert: (collection select: [:c | c isKindOf: TestCaseEnded]) size =( collection size / 2). + self assert: collection size equals: suite tests size * 2. + self assert: (collection select: [ :c | c isKindOf: TestCaseStarted ]) size equals: collection size / 2. + self assert: (collection select: [ :c | c isKindOf: TestCaseEnded ]) size equals: collection size / 2. self assert: (collection allSatisfy: #hasPassed). self deny: (collection anySatisfy: #hasFailures). - + oldCollection := collection copy. unitTest resetAnnouncer. unitTest debug: #testClassCreationInDifferentCategories. - self assert: (collection = oldCollection) + self assert: collection equals: oldCollection ] { #category : #testing } diff --git a/src/Slot-Tests/BooleanSlotTest.class.st b/src/Slot-Tests/BooleanSlotTest.class.st index 0e1bbe5f524..775cce78341 100644 --- a/src/Slot-Tests/BooleanSlotTest.class.st +++ b/src/Slot-Tests/BooleanSlotTest.class.st @@ -9,93 +9,75 @@ Class { { #category : #tests } BooleanSlotTest >> testExampleBooleanSlot [ - | object slot | - slot := #slot1 => BooleanSlot. - aClass := self make: [ :builder | builder slots: {slot} ]. + aClass := self make: [ :builder | builder slots: {slot} ]. self assert: (slot instVarNamed: 'baseSlot') isNotNil. - object := aClass new. + object := aClass new. "test reflective write and read" slot write: true to: object. self assert: (slot read: object). - + "compiled accessors to test code gen" self compileAccessorsFor: slot. - - self assert: object slot1 == true. + + self assert: object slot1 identicalTo: true. object slot1: false. - self assert: object slot1 == false + self assert: object slot1 identicalTo: false ] { #category : #tests } BooleanSlotTest >> testExampleTwoBooleanSlots [ - | object slot1 slot2 | - slot1 := #slot1 => BooleanSlot. slot2 := #slot2 => BooleanSlot. - aClass := self make: [ :builder | - builder - slots: {slot1 . slot2 } - ]. + aClass := self make: [ :builder | builder slots: {slot1 . slot2} ]. self assert: (slot1 instVarNamed: 'baseSlot') isNotNil. - self assert: (slot1 instVarNamed: 'baseSlot') == (slot2 instVarNamed: 'baseSlot'). + self assert: (slot1 instVarNamed: 'baseSlot') identicalTo: (slot2 instVarNamed: 'baseSlot'). - object := aClass new. + object := aClass new. "test reflective write and read" slot1 write: true to: object. self assert: (slot1 read: object) equals: true. - + slot2 write: true to: object. self assert: (slot2 read: object) equals: true. - + slot2 write: true to: object. slot1 write: false to: object. self assert: (slot2 read: object) equals: true. slot2 write: false to: object. self assert: (slot2 read: object) equals: false - - - ] { #category : #tests } BooleanSlotTest >> testExampleTwoBooleanSlotsRemoveOne [ - | object slot1 slot2 | - slot1 := #slot1 => BooleanSlot. slot2 := #slot2 => BooleanSlot. - aClass := self make: [ :builder | - builder - slots: {slot1 . slot2 } - ]. + aClass := self make: [ :builder | builder slots: {slot1 . slot2} ]. self assert: (slot1 instVarNamed: 'baseSlot') isNotNil. - self assert: (slot1 instVarNamed: 'baseSlot') == (slot2 instVarNamed: 'baseSlot'). + self assert: (slot1 instVarNamed: 'baseSlot') identicalTo: (slot2 instVarNamed: 'baseSlot'). - object := aClass new. + object := aClass new. "test reflective write and read" slot1 write: true to: object. self assert: (slot1 read: object). - + slot2 write: true to: object. self assert: (slot2 read: object). - + slot2 write: true to: object. slot1 write: false to: object. self assert: (slot2 read: object). slot2 write: false to: object. self deny: (slot2 read: object). - + aClass removeSlot: slot1 - - - ] diff --git a/src/Slot-Tests/PropertySlotTest.class.st b/src/Slot-Tests/PropertySlotTest.class.st index 771f25a9332..81c3d629ec5 100644 --- a/src/Slot-Tests/PropertySlotTest.class.st +++ b/src/Slot-Tests/PropertySlotTest.class.st @@ -29,33 +29,25 @@ PropertySlotTest >> testCreateClassWithPropertySlot [ { #category : #tests } PropertySlotTest >> testCreateClassWithPropertySlotAddSecond [ "Add instance variables using the builder interface" - - | propertySlot1 propertySlot2| - + + | propertySlot1 propertySlot2 | propertySlot1 := #prop1 => PropertySlot. propertySlot2 := #prop2 => PropertySlot. - - aClass := self make: [ :builder | - builder - slots: {propertySlot1} - ]. + + aClass := self make: [ :builder | builder slots: {propertySlot1} ]. self assert: (aClass hasSlot: propertySlot1). self assert: (aClass classLayout hasSlot: (propertySlot1 instVarNamed: 'baseSlot')). - - aClass := self make: [ :builder | - builder - slots: {propertySlot1. propertySlot2} - ]. - + + aClass := self make: [ :builder | builder slots: {propertySlot1 . propertySlot2} ]. + self assert: (aClass hasSlot: propertySlot1). self assert: (aClass classLayout hasSlot: (propertySlot2 instVarNamed: 'baseSlot')). - - self assert: (propertySlot1 instVarNamed: 'baseSlot') == (propertySlot2 instVarNamed: 'baseSlot'). - + + self assert: (propertySlot1 instVarNamed: 'baseSlot') identicalTo: (propertySlot2 instVarNamed: 'baseSlot'). + self assert: (aClass hasSlot: propertySlot2). self assert: (aClass classLayout hasSlot: (propertySlot2 instVarNamed: 'baseSlot')) - ] { #category : #tests } diff --git a/src/Slot-Tests/RelationSetTest.class.st b/src/Slot-Tests/RelationSetTest.class.st index dce14a1517a..1152fdbba46 100644 --- a/src/Slot-Tests/RelationSetTest.class.st +++ b/src/Slot-Tests/RelationSetTest.class.st @@ -9,11 +9,10 @@ RelationSetTest >> testCopy [ "A copy of an RelationSet should give us a regular Set." | movie | - movie := SlotExampleMovie new. self assert: movie actors isCollection. self assert: movie actors copy isCollection. - self deny: movie actors copy class = RelationSet + self deny: movie actors copy class equals: RelationSet ] { #category : #tests } diff --git a/src/Slot-Tests/RelationSlotTest.class.st b/src/Slot-Tests/RelationSlotTest.class.st index 9b7cfe57862..d876930d323 100644 --- a/src/Slot-Tests/RelationSlotTest.class.st +++ b/src/Slot-Tests/RelationSlotTest.class.st @@ -53,12 +53,9 @@ RelationSlotTest >> testEquals [ { #category : #tests } RelationSlotTest >> testNotEquals [ - | s1 s2 | - s1 := ToManyRelationSlot named: #slot inverse: #x inClass: #SlotExamplePerson. s2 := ToManyRelationSlot named: #slot inverse: #y inClass: #SlotExamplePerson. - - self deny: s1 = s2 + self deny: s1 equals: s2 ] diff --git a/src/Slot-Tests/SlotAnnouncementsTest.class.st b/src/Slot-Tests/SlotAnnouncementsTest.class.st index a813830d5a1..cf13f96f700 100644 --- a/src/Slot-Tests/SlotAnnouncementsTest.class.st +++ b/src/Slot-Tests/SlotAnnouncementsTest.class.st @@ -170,19 +170,16 @@ SlotAnnouncementsTest >> testClassCreationShouldAnnounceClassAdded [ { #category : #tests } SlotAnnouncementsTest >> testClassRecategorizationShouldAnnounceClassModified [ - self subscribeOn: ClassRecategorized. - - aClass := self make: [ :builder| - builder category: self aCategory ]. - anotherClass := self make: [ :builder| - builder category: self anotherCategory ]. - + + aClass := self make: [ :builder | builder category: self aCategory ]. + anotherClass := self make: [ :builder | builder category: self anotherCategory ]. + self assert: self collectedAnnouncements size equals: 1. - announcement := self collectedAnnouncements first. + announcement := self collectedAnnouncements first. self assert: announcement oldCategory equals: self aCategory. self assert: announcement newCategory equals: self anotherCategory. - self assert: announcement classRecategorized == anotherClass + self assert: announcement classRecategorized identicalTo: anotherClass ] { #category : #'tests-comments' } diff --git a/src/Slot-Tests/SlotBasicTest.class.st b/src/Slot-Tests/SlotBasicTest.class.st index 6a0bc591a2f..0d7b4374ad9 100644 --- a/src/Slot-Tests/SlotBasicTest.class.st +++ b/src/Slot-Tests/SlotBasicTest.class.st @@ -50,14 +50,11 @@ SlotBasicTest >> testAddSharedVariable [ { #category : #'tests-basic' } SlotBasicTest >> testBasicClassBuilding [ + aClass := self make: [ :builder | builder name: self aClassName ]. - aClass := self make: [ :builder | - builder name: self aClassName ]. - self deny: aClass classLayout isNil. - self assert: aClass name = self aClassName. - self assert: (self class environment at: self aClassName) == aClass - + self assert: aClass name equals: self aClassName. + self assert: (self class environment at: self aClassName) identicalTo: aClass ] { #category : #'tests-comments' } diff --git a/src/Slot-Tests/SlotEnvironmentTest.class.st b/src/Slot-Tests/SlotEnvironmentTest.class.st index 15c359f6070..303e6d35bca 100644 --- a/src/Slot-Tests/SlotEnvironmentTest.class.st +++ b/src/Slot-Tests/SlotEnvironmentTest.class.st @@ -8,13 +8,12 @@ Class { SlotEnvironmentTest >> testBasicEnvironment [ | environment | environment := SystemDictionary new. - - aClass := self make: [ :builder | - builder environment: environment ]. - self assert: (aClass environment == environment). - self assert: (environment includesKey: aClass name). - self assert: (environment at: aClass name) == aClass. - + aClass := self make: [ :builder | builder environment: environment ]. + + self assert: aClass environment identicalTo: environment. + self assert: (environment includesKey: aClass name). + self assert: (environment at: aClass name) identicalTo: aClass. + self deny: (testingEnvironment includesKey: aClass name) ] diff --git a/src/Slot-Tests/SlotIntegrationTest.class.st b/src/Slot-Tests/SlotIntegrationTest.class.st index 566a839f4c3..90f37869df1 100644 --- a/src/Slot-Tests/SlotIntegrationTest.class.st +++ b/src/Slot-Tests/SlotIntegrationTest.class.st @@ -118,32 +118,33 @@ SlotIntegrationTest >> testAddInstVarNamedClassInterface [ { #category : #tests } SlotIntegrationTest >> testAddInstVarNamedWithTrait [ "Add instance variables using the builder interface" - - aClass := self make: [ :builder | - builder - name: self aClassName; - traitComposition: TOne; - slots: #( x ) - ]. + + aClass := self + make: [ :builder | + builder + name: self aClassName; + traitComposition: TOne; + slots: #(x) ]. self assertTraitIntegrity. self assert: aClass instVarNames equals: #(x). - - self assert: TOne traitUsers asArray equals: { aClass }. - + + self assert: TOne traitUsers asArray equals: {aClass}. + self assert: (aClass canUnderstand: #one). self assert: aClass new one equals: 1. - aClass := self make: [ :builder | - builder - name: self aClassName; - traitComposition: TOne; - slots: #( x y )]. - + aClass := self + make: [ :builder | + builder + name: self aClassName; + traitComposition: TOne; + slots: #(x y) ]. + self assertTraitIntegrity. - self assert: aClass instVarNames = #(x y). - - self assert: TOne traitUsers asArray equals: { aClass }. - + self assert: aClass instVarNames equals: #(x y). + + self assert: TOne traitUsers asArray equals: {aClass}. + self assert: (aClass canUnderstand: #one). self assert: aClass new one equals: 1 ] @@ -180,18 +181,17 @@ SlotIntegrationTest >> testAddInstVarNamedWithTrait2 [ { #category : #tests } SlotIntegrationTest >> testAnonymousSubclass [ - - aClass := self make: [ :builder | - builder - name: self aClassName; - slots: #(x) - ]. + aClass := self + make: [ :builder | + builder + name: self aClassName; + slots: #(x) ]. anotherClass := aClass newAnonymousSubclass. - self deny: anotherClass == aClass. + self deny: anotherClass identicalTo: aClass. self assert: anotherClass isBehavior. - self assert: anotherClass superclass == aClass. - self deny: anotherClass name = aClass name. + self assert: anotherClass superclass identicalTo: aClass. + self deny: anotherClass name equals: aClass name. self assert: anotherClass allInstVarNames equals: #(x) ] diff --git a/src/Slot-Tests/SlotMethodRecompilationTest.class.st b/src/Slot-Tests/SlotMethodRecompilationTest.class.st index 5f48297b1bd..db8e5ed70a9 100644 --- a/src/Slot-Tests/SlotMethodRecompilationTest.class.st +++ b/src/Slot-Tests/SlotMethodRecompilationTest.class.st @@ -39,32 +39,29 @@ SlotMethodRecompilationTest >> testClassReshapeShouldKeepClassBinding [ "Check that when a class is reshaped, the recompilation of the methods gives correct class bindings (in the literal array of the methods)" self reshapeClass. - self assert: self methodBinding == class binding + self assert: self methodBinding identicalTo: class binding ] { #category : #tests } SlotMethodRecompilationTest >> testClassReshapeShouldKeepClassBindingForTraitMethods [ "A method should have the same binding than its class even if it come from a trait" + self reshapeClass. - self assert: (self traitMethodBinding == class binding) - - + self assert: self traitMethodBinding identicalTo: class binding ] { #category : #tests } SlotMethodRecompilationTest >> testMethodClassBindingShouldBeClassBinding [ "A method should have the same binding than its class" - self assert: (self methodBinding == class binding) - - + + self assert: self methodBinding identicalTo: class binding ] { #category : #tests } SlotMethodRecompilationTest >> testTraitMethodClassBindingShouldBeClassBinding [ "A method should have the same binding than its class even if it come from a trait" - self assert: (self traitMethodBinding == class binding) - - + + self assert: self traitMethodBinding identicalTo: class binding ] { #category : #accessing } diff --git a/src/Slot-Tests/SlotMigrationTest.class.st b/src/Slot-Tests/SlotMigrationTest.class.st index bd262e63c1e..43f57ea72d9 100644 --- a/src/Slot-Tests/SlotMigrationTest.class.st +++ b/src/Slot-Tests/SlotMigrationTest.class.st @@ -12,29 +12,32 @@ SlotMigrationTest >> testAddSharedVariableKeepSubclasses [ "Reproduces fogbugz case 13028" "Define original hierarchy" - aClass := self make: [ :builder | - builder - name: self aClassName; - superclass: Object ]. - anotherClass := self make: [ :builder | - builder - name: self anotherClassName; - superclass: aClass ]. + aClass := self + make: [ :builder | + builder + name: self aClassName; + superclass: Object ]. + + anotherClass := self + make: [ :builder | + builder + name: self anotherClassName; + superclass: aClass ]. self assert: aClass subclasses size equals: 1. - self assert: aClass subclasses anyOne == anotherClass. + self assert: aClass subclasses anyOne identicalTo: anotherClass. "Add a shared variable" - aClass := self make: [ :builder | - builder - name: self aClassName; - superclass: Object; - sharedVariablesFromString: 'Var' ]. - - self assert: aClass subclasses size equals: 1. - self assert: aClass subclasses anyOne == anotherClass + aClass := self + make: [ :builder | + builder + name: self aClassName; + superclass: Object; + sharedVariablesFromString: 'Var' ]. + self assert: aClass subclasses size equals: 1. + self assert: aClass subclasses anyOne identicalTo: anotherClass ] { #category : #tests } @@ -138,8 +141,8 @@ SlotMigrationTest >> testChangeSuperclass [ superclass: aClass ]. self assert: aClass subclasses size equals: 1. - self assert: aClass subclasses anyOne == anotherClass. - self assert: anotherClass superclass == aClass. + self assert: aClass subclasses anyOne identicalTo: anotherClass. + self assert: anotherClass superclass identicalTo: aClass. "Change to a new superclass" yetAnotherClass := self @@ -156,8 +159,8 @@ SlotMigrationTest >> testChangeSuperclass [ self assertEmpty: aClass subclasses. self assert: yetAnotherClass subclasses size equals: 1. - self assert: yetAnotherClass subclasses anyOne == anotherClass. - self assert: anotherClass superclass == yetAnotherClass + self assert: yetAnotherClass subclasses anyOne identicalTo: anotherClass. + self assert: anotherClass superclass identicalTo: yetAnotherClass ] { #category : #tests } diff --git a/src/Slot-Tests/TemporaryVariableTest.class.st b/src/Slot-Tests/TemporaryVariableTest.class.st index 82e6531bc9d..8207459e5ec 100644 --- a/src/Slot-Tests/TemporaryVariableTest.class.st +++ b/src/Slot-Tests/TemporaryVariableTest.class.st @@ -40,80 +40,66 @@ TemporaryVariableTest >> testPropertyAtPut [ { #category : #properties } TemporaryVariableTest >> testPropertyAtPutPersistent [ - | testValue temp temp2 | testValue := Date today. temp := thisContext method temporaryVariableNamed: #temp. - + temp propertyAt: #testKeySelector put: testValue. - self - assert: (temp propertyAt: #testKeySelector) - equals: testValue. - + self assert: (temp propertyAt: #testKeySelector) equals: testValue. + temp2 := thisContext method temporaryVariableNamed: #temp. - - self - assert: (temp2 propertyAt: #testKeySelector) - equals: testValue. - - self assert: temp2 == temp. - self deny: thisContext method savedTemps isNil. + + self assert: (temp2 propertyAt: #testKeySelector) equals: testValue. + + self assert: temp2 identicalTo: temp. + self deny: thisContext method savedTemps isNil. temp removeProperty: #testKeySelector. self assert: temp properties isNil. - + self assert: thisContext method savedTemps isNil ] { #category : #properties } TemporaryVariableTest >> testPropertyBlockPersistent [ - | testValue temp temp2 block | testValue := Date today. - block := [ |t| t:=2]. + block := [ | t | + t := 2 ]. temp := block temporaryVariableNamed: #t. - + temp propertyAt: #testKeySelector put: testValue. - self - assert: (temp propertyAt: #testKeySelector) - equals: testValue. - + self assert: (temp propertyAt: #testKeySelector) equals: testValue. + temp2 := block temporaryVariableNamed: #t. - - self - assert: (temp2 propertyAt: #testKeySelector) - equals: testValue. - - self assert: temp2 == temp. - self deny: block method savedTemps isNil. + + self assert: (temp2 propertyAt: #testKeySelector) equals: testValue. + + self assert: temp2 identicalTo: temp. + self deny: block method savedTemps isNil. temp removeProperty: #testKeySelector. self assert: temp properties isNil. - + self assert: block method savedTemps isNil ] { #category : #properties } TemporaryVariableTest >> testPropertyContextPersistent [ - | testValue temp temp2 | testValue := Date today. temp := thisContext temporaryVariableNamed: #temp. - + temp propertyAt: #testKeySelector put: testValue. - self - assert: (temp propertyAt: #testKeySelector) - equals: testValue. - + self assert: (temp propertyAt: #testKeySelector) equals: testValue. + temp2 := thisContext temporaryVariableNamed: #temp. - - self - assert: (temp2 propertyAt: #testKeySelector) - equals: testValue. - - self assert: temp2 == temp. - self deny: thisContext method savedTemps isNil. + + self assert: (temp2 propertyAt: #testKeySelector) equals: testValue. + + self assert: temp2 identicalTo: temp. + self deny: thisContext method savedTemps isNil. temp removeProperty: #testKeySelector. self assert: temp properties isNil. - + self assert: thisContext method savedTemps isNil ] @@ -122,7 +108,7 @@ TemporaryVariableTest >> testReadTemporaryVariablesMethod [ | tempVar | tempVar := thisContext temporaryVariableNamed: #tempVar. - self assert: (tempVar readInContext: thisContext) class = TemporaryVariable + self assert: (tempVar readInContext: thisContext) class equals: TemporaryVariable ] { #category : #tests } diff --git a/src/Slot-Tests/UnlimitedInstanceVariableSlotTest.class.st b/src/Slot-Tests/UnlimitedInstanceVariableSlotTest.class.st index 4eab2754498..5bcf693b8bd 100644 --- a/src/Slot-Tests/UnlimitedInstanceVariableSlotTest.class.st +++ b/src/Slot-Tests/UnlimitedInstanceVariableSlotTest.class.st @@ -6,53 +6,46 @@ Class { { #category : #'test - unlimited ivars' } UnlimitedInstanceVariableSlotTest >> testExampleIvarSlot [ - | object slot | - slot := #slot1 => UnlimitedInstanceVariableSlot. aClass := self make: [ :builder | builder slots: {slot} ]. self assert: (slot instVarNamed: 'baseSlot') isNotNil. - object := aClass new. + object := aClass new. "test reflective write and read" slot write: 5 to: object. - self assert: (slot read: object) == 5. - + self assert: (slot read: object) identicalTo: 5. + self compileAccessorsFor: slot. - - self assert: object slot1 == 5. + + self assert: object slot1 identicalTo: 5. object slot1: false. self deny: object slot1 ] { #category : #'test - unlimited ivars' } UnlimitedInstanceVariableSlotTest >> testExampleTwoIvarSlots [ - | object slot1 slot2 | - slot1 := #slot1 => UnlimitedInstanceVariableSlot. slot2 := #slot2 => UnlimitedInstanceVariableSlot. - aClass := self make: [ :builder | builder slots: {slot1 . slot2 }]. + aClass := self make: [ :builder | builder slots: {slot1 . slot2} ]. self assert: (slot1 instVarNamed: 'baseSlot') isNotNil. - self assert: (slot1 instVarNamed: 'baseSlot') == (slot2 instVarNamed: 'baseSlot'). + self assert: (slot1 instVarNamed: 'baseSlot') identicalTo: (slot2 instVarNamed: 'baseSlot'). - object := aClass new. + object := aClass new. "test reflective write and read" slot1 write: true to: object. self assert: (slot1 read: object). - + slot2 write: true to: object. self assert: (slot2 read: object). - + slot2 write: true to: object. slot1 write: false to: object. self assert: (slot2 read: object). slot2 write: false to: object. self deny: (slot2 read: object) - - - ] diff --git a/src/Spec-Tests/AbstractTwoButtonsTest.class.st b/src/Spec-Tests/AbstractTwoButtonsTest.class.st index 82c3d3c3b2c..179ef769c97 100644 --- a/src/Spec-Tests/AbstractTwoButtonsTest.class.st +++ b/src/Spec-Tests/AbstractTwoButtonsTest.class.st @@ -24,8 +24,8 @@ AbstractTwoButtonsTest >> testFirstActionSecondAction [ { #category : #tests } AbstractTwoButtonsTest >> testFirstIconSecondIcon [ testedInstance firstIcon: #thumbsUp secondIcon: #thumbsDown. - self assert: testedInstance firstButton icon == (self iconNamed: #thumbsUp). - self assert: testedInstance secondButton icon == (self iconNamed: #thumbsDown) + self assert: testedInstance firstButton icon identicalTo: (self iconNamed: #thumbsUp). + self assert: testedInstance secondButton icon identicalTo: (self iconNamed: #thumbsDown) ] { #category : #tests } diff --git a/src/Spec-Tests/ComposablePresenterWithModelTest.class.st b/src/Spec-Tests/ComposablePresenterWithModelTest.class.st index 771aa2af8b1..e28707bec39 100644 --- a/src/Spec-Tests/ComposablePresenterWithModelTest.class.st +++ b/src/Spec-Tests/ComposablePresenterWithModelTest.class.st @@ -37,8 +37,8 @@ ComposablePresenterWithModelTest >> testInstanceCreationWithValueHolder [ { #category : #testing } ComposablePresenterWithModelTest >> testModelSettingModelToModel [ - "we had a Model, new model is another Model" + | model model2 presenter | model := TestingPointModel x: 1 y: 2. model2 := TestingPointModel x: 4 y: 5. @@ -50,18 +50,15 @@ ComposablePresenterWithModelTest >> testModelSettingModelToModel [ presenter model: model2. self assert: presenter announcingObject isAnnouncingObject. self deny: presenter announcingObject isValueHolder. - self assert: presenter announcingObject == model2. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter announcingObject identicalTo: model2. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } ComposablePresenterWithModelTest >> testModelSettingModelToValueHolder [ - | point model presenter | - "we had value holder, new model is a model" - point := 40@54. + point := 40 @ 54. presenter := TestingComposablePresenterWithModel on: point. model := TestingPointModel x: 1 y: 2. @@ -72,20 +69,16 @@ ComposablePresenterWithModelTest >> testModelSettingModelToValueHolder [ presenter model: model. self assert: presenter announcingObject isAnnouncingObject. self deny: presenter announcingObject isValueHolder. - self assert: presenter announcingObject == model. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - - + self assert: presenter announcingObject identicalTo: model. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } ComposablePresenterWithModelTest >> testModelSettingObjectToModel [ - | point model presenter | - "we had a Model, new model is a regular object" model := TestingPointModel x: 1 y: 2. - point := 40@54. + point := 40 @ 54. presenter := TestingComposablePresenterWithModel on: model. self assert: presenter announcingObject isAnnouncingObject. self deny: presenter announcingObject isValueHolder. @@ -94,21 +87,17 @@ ComposablePresenterWithModelTest >> testModelSettingObjectToModel [ presenter model: point. self assert: presenter announcingObject isAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter model == point. - self deny: presenter announcingObject == model. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - - + self assert: presenter model identicalTo: point. + self deny: presenter announcingObject identicalTo: model. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } ComposablePresenterWithModelTest >> testModelSettingObjectToValueHolder [ - | point point2 presenter | - "we had value holder, new model is a regular object" - point := 40@54. - point2 := 1@0. + point := 40 @ 54. + point2 := 1 @ 0. presenter := TestingComposablePresenterWithModel on: point. self assert: presenter announcingObject isAnnouncingObject. self assert: presenter announcingObject isValueHolder. @@ -117,17 +106,16 @@ ComposablePresenterWithModelTest >> testModelSettingObjectToValueHolder [ presenter model: point2. self assert: presenter announcingObject isAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter model == point2. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter model identicalTo: point2. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } ComposablePresenterWithModelTest >> testModelSettingValueHolderToModel [ - "we had a Model, new model is a value holder" + | model point valueHolder presenter | - point := 1@0. + point := 1 @ 0. model := TestingPointModel x: 1 y: 2. valueHolder := NewValueHolder value: point. presenter := TestingComposablePresenterWithModel on: model. @@ -138,20 +126,17 @@ ComposablePresenterWithModelTest >> testModelSettingValueHolderToModel [ presenter model: valueHolder. self assert: presenter announcingObject isAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter announcingObject == valueHolder. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter announcingObject identicalTo: valueHolder. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } ComposablePresenterWithModelTest >> testModelSettingValueHolderToValueHolder [ - | point point2 valueHolder presenter | - "we had value holder, new model is a regular object" - point := 40@54. - point2 := 1@0. - + point := 40 @ 54. + point2 := 1 @ 0. + "we had value holder, new model is a value holder" presenter := TestingComposablePresenterWithModel on: point. valueHolder := NewValueHolder value: point2. @@ -162,64 +147,55 @@ ComposablePresenterWithModelTest >> testModelSettingValueHolderToValueHolder [ presenter model: valueHolder. self assert: presenter announcingObject isAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter model == point2. - self assert: presenter announcingObject == valueHolder. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter model identicalTo: point2. + self assert: presenter announcingObject identicalTo: valueHolder. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } ComposablePresenterWithModelTest >> testUpdateModel [ - | aPoint presenter | - aPoint := TestingPointModel x: 40 y: 54. presenter := TestingComposablePresenterWithModel on: aPoint. - + self assert: presenter x text equals: aPoint x asString. self assert: presenter y text equals: aPoint y asString. - - aPoint x: 1; y: 2. + + aPoint + x: 1; + y: 2. aPoint valueChanged. - + "the point itself is not subscribed to the presenter" - self assert: (presenter x text = aPoint x asString). - self assert: (presenter y text = aPoint y asString). - - - + self assert: presenter x text equals: aPoint x asString. + self assert: presenter y text equals: aPoint y asString ] { #category : #testing } ComposablePresenterWithModelTest >> testUpdateModelWithValueHolder [ - | aPoint aValueHolder presenter anAnnouncer | - "create a point and a value holder that contains it and can react on announcements" - aPoint := 40@54. + aPoint := 40 @ 54. aValueHolder := NewValueHolder value: aPoint. - - self assert: (aValueHolder value == aPoint). + + self assert: aValueHolder value identicalTo: aPoint. anAnnouncer := aValueHolder announcer. - self assert: (aValueHolder announcer subscriptions subscriptions size) equals: 0. - + self assert: aValueHolder announcer subscriptions subscriptions size equals: 0. + presenter := TestingComposablePresenterWithModel on: aValueHolder. - self assert: (anAnnouncer == aValueHolder announcer). + self assert: anAnnouncer identicalTo: aValueHolder announcer. self assert: presenter x text equals: aPoint x asString. self assert: presenter y text equals: aPoint y asString. - + aPoint setX: 1 setY: 2. - self assert: (aValueHolder value == aPoint). + self assert: aValueHolder value identicalTo: aPoint. aValueHolder valueChanged. - self assert: (anAnnouncer == aValueHolder announcer). - + self assert: anAnnouncer identicalTo: aValueHolder announcer. + "the point itself is not subscribed to the presenter" self assert: presenter x text equals: aPoint x asString. - self assert: presenter y text equals: aPoint y asString. - - - + self assert: presenter y text equals: aPoint y asString ] diff --git a/src/Spec-Tests/ListPresenterTest.class.st b/src/Spec-Tests/ListPresenterTest.class.st index 82e233ceffa..ffe3534dfc2 100644 --- a/src/Spec-Tests/ListPresenterTest.class.st +++ b/src/Spec-Tests/ListPresenterTest.class.st @@ -45,8 +45,8 @@ ListPresenterTest >> testWhenListChangedOldContents [ testedInstance items: oldL. testedInstance whenListChanged: [ :aList :anOldList | - self assert: oldL = anOldList. - self assert: newL = aList ]. + self assert: oldL equals: anOldList. + self assert: newL equals: aList ]. testedInstance listItems. "Call listItems to set the cache" testedInstance items: #(1 2 3) ] diff --git a/src/Spec-Tests/RGBSlidersTest.class.st b/src/Spec-Tests/RGBSlidersTest.class.st index c54557ed04d..8179bbb86b4 100644 --- a/src/Spec-Tests/RGBSlidersTest.class.st +++ b/src/Spec-Tests/RGBSlidersTest.class.st @@ -11,22 +11,24 @@ RGBSlidersTest >> classToTest [ { #category : #tests } RGBSlidersTest >> testColor [ - |random red green blue | + | random red green blue | random := Random new. red := random nextInt: 255. - green := random nextInt: 255. - blue := random nextInt: 255. - + green := random nextInt: 255. + blue := random nextInt: 255. + testedInstance redSlider value: red. - testedInstance greenSlider value:green. - testedInstance blueSlider value:blue. - - self assert: (testedInstance color) = - (Color - r: red - g: green - b: blue - range: 255). + testedInstance greenSlider value: green. + testedInstance blueSlider value: blue. + + self + assert: testedInstance color + equals: + (Color + r: red + g: green + b: blue + range: 255) ] { #category : #tests } @@ -37,5 +39,5 @@ RGBSlidersTest >> testwhenChangedDo [ testedInstance redSlider value: 66. testedInstance greenSlider value: 17. testedInstance blueSlider value: 200. - self assert: numberOfChanges = 3 + self assert: numberOfChanges equals: 3 ] diff --git a/src/Spec-Tests/RadioButtonGroupPresenterTest.class.st b/src/Spec-Tests/RadioButtonGroupPresenterTest.class.st index a454a363857..9747dd84ace 100644 --- a/src/Spec-Tests/RadioButtonGroupPresenterTest.class.st +++ b/src/Spec-Tests/RadioButtonGroupPresenterTest.class.st @@ -21,11 +21,11 @@ RadioButtonGroupPresenterTest >> initializeTestedInstance [ { #category : #tests } RadioButtonGroupPresenterTest >> testAddRadioButton [ - self assert: testedInstance buttons size == 0. + self assert: testedInstance buttons size identicalTo: 0. testedInstance addRadioButton: radio1; addRadioButton: radio2. - self assert: testedInstance buttons size == 2 + self assert: testedInstance buttons size identicalTo: 2 ] { #category : #tests } @@ -48,7 +48,7 @@ RadioButtonGroupPresenterTest >> testCurrentActivated [ { #category : #tests } RadioButtonGroupPresenterTest >> testDefault [ testedInstance addRadioButton: radio1. - self assert: radio1 state == false + self assert: radio1 state identicalTo: false ] { #category : #tests } @@ -56,14 +56,14 @@ RadioButtonGroupPresenterTest >> testLinkRadioButton [ testedInstance addRadioButton: radio1; addRadioButton: radio2. - self assert: radio1 state == false. - self assert: radio2 state == false. + self assert: radio1 state identicalTo: false. + self assert: radio2 state identicalTo: false. radio1 click. - self assert: radio1 state == true. - self assert: radio2 state == false. + self assert: radio1 state identicalTo: true. + self assert: radio2 state identicalTo: false. radio2 click. - self assert: radio1 state == false. - self assert: radio2 state == true + self assert: radio1 state identicalTo: false. + self assert: radio2 state identicalTo: true ] { #category : #tests } @@ -72,5 +72,5 @@ RadioButtonGroupPresenterTest >> testRebuildWidget [ addRadioButton: radio1; addRadioButton: radio2. self shouldnt: [ testedInstance radio2 ] raise: Error. - self assert: testedInstance buttons size == 2 + self assert: testedInstance buttons size identicalTo: 2 ] diff --git a/src/Spec-Tests/SliderPresenterTest.class.st b/src/Spec-Tests/SliderPresenterTest.class.st index 430564d1b0a..1c703e0b8b5 100644 --- a/src/Spec-Tests/SliderPresenterTest.class.st +++ b/src/Spec-Tests/SliderPresenterTest.class.st @@ -19,7 +19,7 @@ SliderPresenterTest >> initMinMax [ SliderPresenterTest >> testAbsoluteValue [ self initMinMax. testedInstance absoluteValue: 0.5. - self assert: testedInstance value == 50 + self assert: testedInstance value identicalTo: 50 ] { #category : #tests } @@ -28,5 +28,5 @@ SliderPresenterTest >> testReset [ testedInstance value: 50; reset. - self assert: testedInstance value == 0 + self assert: testedInstance value identicalTo: 0 ] diff --git a/src/Spec-Tests/SpecFocusOrderTest.class.st b/src/Spec-Tests/SpecFocusOrderTest.class.st index 8147dcc708a..6bf06f3d92f 100644 --- a/src/Spec-Tests/SpecFocusOrderTest.class.st +++ b/src/Spec-Tests/SpecFocusOrderTest.class.st @@ -71,7 +71,7 @@ SpecFocusOrderTest >> testRemoveAll [ add: button1; add: button2 ] raise: Error; - assert: specFocusOrder presenters size == 2; + assert: specFocusOrder presenters size identicalTo: 2; shouldnt: [ specFocusOrder removeAll ] raise: Error; assert: specFocusOrder presenters isEmpty ] diff --git a/src/Spec-Tests/SpecInterpreterTest.class.st b/src/Spec-Tests/SpecInterpreterTest.class.st index 036cd60537a..1a9dac01641 100644 --- a/src/Spec-Tests/SpecInterpreterTest.class.st +++ b/src/Spec-Tests/SpecInterpreterTest.class.st @@ -35,49 +35,46 @@ SpecInterpreterTest >> testBuildWidgetForWithSpec [ | model morph | model := TestingComposablePresenter new. morph := model buildWithSpec: #testingSpec. - self assert: morph model == model. - self assert: model widget class = RubPluggableTextMorph + self assert: morph model identicalTo: model. + self assert: model widget class equals: RubPluggableTextMorph ] { #category : #tests } SpecInterpreterTest >> testConvertRandomSymbolOfClassToInstance [ - | symbol instance | symbol := #PluggableListMorph. - + instance := specInterpreter convertSymbolOfClassToInstance: symbol. - self assert: (instance class name = symbol) + self assert: instance class name equals: symbol ] { #category : #tests } SpecInterpreterTest >> testDynamicBuild [ - | model widget1 widget2 widget3 | model := TestingComposablePresenter new. - model openWithSpec close. + model openWithSpec close. widget1 := model list widget. - + model openWithSpec close. widget2 := model list widget. - - self deny: widget1 == widget2. - + + self deny: widget1 identicalTo: widget2. + model list needRebuild: false. model needRebuild: false. model openWithSpec close. widget3 := model list widget. - - self assert: widget2 == widget3. + + self assert: widget2 identicalTo: widget3. self assert: model needRebuild ] { #category : #tests } SpecInterpreterTest >> testInterpretASpecModelMorphAssociation [ - | spec model morph | model := AbstractWidgetPresenter new. - spec := {#PluggableListMorph. #model:. #model}. + spec := {#PluggableListMorph . #model: . #model}. morph := specInterpreterClass interpretASpec: spec model: model. - - self assert: (model widget == morph). + + self assert: model widget identicalTo: morph ] diff --git a/src/Spec-Tests/TabPresenterTest.class.st b/src/Spec-Tests/TabPresenterTest.class.st index 606e7d55f8d..f5d559e727b 100644 --- a/src/Spec-Tests/TabPresenterTest.class.st +++ b/src/Spec-Tests/TabPresenterTest.class.st @@ -34,12 +34,12 @@ TabPresenterTest >> testChangeLabel [ self redMorphTab. manager addTab: testedInstance. - self assert: testedInstance label = 'Red Morph'. + self assert: testedInstance label equals: 'Red Morph'. testedInstance label: 'Change Before Opening'. - self assert: testedInstance label = 'Change Before Opening'. + self assert: testedInstance label equals: 'Change Before Opening'. window := manager openWithSpec. testedInstance label: 'Change After Opening'. - self assert: testedInstance label = 'Change After Opening' + self assert: testedInstance label equals: 'Change After Opening' ] { #category : #tests } diff --git a/src/Spec2-Deprecated/SpAbstractTwoButtonsTest.class.st b/src/Spec2-Deprecated/SpAbstractTwoButtonsTest.class.st index 0ebf371d6b9..e99e3d44e96 100644 --- a/src/Spec2-Deprecated/SpAbstractTwoButtonsTest.class.st +++ b/src/Spec2-Deprecated/SpAbstractTwoButtonsTest.class.st @@ -31,8 +31,8 @@ SpAbstractTwoButtonsTest >> testFirstActionSecondAction [ { #category : #tests } SpAbstractTwoButtonsTest >> testFirstIconSecondIcon [ presenter firstIcon: #thumbsUp secondIcon: #thumbsDown. - self assert: presenter firstButton icon == (self iconNamed: #thumbsUp). - self assert: presenter secondButton icon == (self iconNamed: #thumbsDown) + self assert: presenter firstButton icon identicalTo: (self iconNamed: #thumbsUp). + self assert: presenter secondButton icon identicalTo: (self iconNamed: #thumbsDown) ] { #category : #tests } diff --git a/src/Spec2-Tests/SpComposablePresenterWithModelTest.class.st b/src/Spec2-Tests/SpComposablePresenterWithModelTest.class.st index 13946bbe5a3..ec09540eb53 100644 --- a/src/Spec2-Tests/SpComposablePresenterWithModelTest.class.st +++ b/src/Spec2-Tests/SpComposablePresenterWithModelTest.class.st @@ -37,8 +37,8 @@ SpComposablePresenterWithModelTest >> testInstanceCreationWithValueHolder [ { #category : #testing } SpComposablePresenterWithModelTest >> testModelSettingModelToModel [ - "we had a Model, new model is another Model" + | model model2 presenter | model := SpTestingPointModel x: 1 y: 2. model2 := SpTestingPointModel x: 4 y: 5. @@ -50,18 +50,15 @@ SpComposablePresenterWithModelTest >> testModelSettingModelToModel [ presenter model: model2. self assert: presenter announcingObject isSpAnnouncingObject. self deny: presenter announcingObject isValueHolder. - self assert: presenter announcingObject == model2. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter announcingObject identicalTo: model2. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } SpComposablePresenterWithModelTest >> testModelSettingModelToValueHolder [ - | point model presenter | - "we had value holder, new model is a model" - point := 40@54. + point := 40 @ 54. presenter := SpTestingPresenterWithModel on: point. model := SpTestingPointModel x: 1 y: 2. @@ -72,20 +69,16 @@ SpComposablePresenterWithModelTest >> testModelSettingModelToValueHolder [ presenter model: model. self assert: presenter announcingObject isSpAnnouncingObject. self deny: presenter announcingObject isValueHolder. - self assert: presenter announcingObject == model. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - - + self assert: presenter announcingObject identicalTo: model. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } SpComposablePresenterWithModelTest >> testModelSettingObjectToModel [ - | point model presenter | - "we had a Model, new model is a regular object" model := SpTestingPointModel x: 1 y: 2. - point := 40@54. + point := 40 @ 54. presenter := SpTestingPresenterWithModel on: model. self assert: presenter announcingObject isSpAnnouncingObject. self deny: presenter announcingObject isValueHolder. @@ -94,21 +87,17 @@ SpComposablePresenterWithModelTest >> testModelSettingObjectToModel [ presenter model: point. self assert: presenter announcingObject isSpAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter model == point. - self deny: presenter announcingObject == model. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - - + self assert: presenter model identicalTo: point. + self deny: presenter announcingObject identicalTo: model. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } SpComposablePresenterWithModelTest >> testModelSettingObjectToValueHolder [ - | point point2 presenter | - "we had value holder, new model is a regular object" - point := 40@54. - point2 := 1@0. + point := 40 @ 54. + point2 := 1 @ 0. presenter := SpTestingPresenterWithModel on: point. self assert: presenter announcingObject isSpAnnouncingObject. self assert: presenter announcingObject isValueHolder. @@ -117,17 +106,16 @@ SpComposablePresenterWithModelTest >> testModelSettingObjectToValueHolder [ presenter model: point2. self assert: presenter announcingObject isSpAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter model == point2. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter model identicalTo: point2. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } SpComposablePresenterWithModelTest >> testModelSettingValueHolderToModel [ - "we had a Model, new model is a value holder" + | model point valueHolder presenter | - point := 1@0. + point := 1 @ 0. model := SpTestingPointModel x: 1 y: 2. valueHolder := NewValueHolder value: point. presenter := SpTestingPresenterWithModel on: model. @@ -138,20 +126,17 @@ SpComposablePresenterWithModelTest >> testModelSettingValueHolderToModel [ presenter model: valueHolder. self assert: presenter announcingObject isSpAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter announcingObject == valueHolder. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter announcingObject identicalTo: valueHolder. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } SpComposablePresenterWithModelTest >> testModelSettingValueHolderToValueHolder [ - | point point2 valueHolder presenter | - "we had value holder, new model is a regular object" - point := 40@54. - point2 := 1@0. - + point := 40 @ 54. + point2 := 1 @ 0. + "we had value holder, new model is a value holder" presenter := SpTestingPresenterWithModel on: point. valueHolder := NewValueHolder value: point2. @@ -162,10 +147,9 @@ SpComposablePresenterWithModelTest >> testModelSettingValueHolderToValueHolder [ presenter model: valueHolder. self assert: presenter announcingObject isSpAnnouncingObject. self assert: presenter announcingObject isValueHolder. - self assert: presenter model == point2. - self assert: presenter announcingObject == valueHolder. - self assert: presenter announcingObject announcer numberOfSubscriptions > 0. - + self assert: presenter model identicalTo: point2. + self assert: presenter announcingObject identicalTo: valueHolder. + self assert: presenter announcingObject announcer numberOfSubscriptions > 0 ] { #category : #testing } @@ -193,33 +177,28 @@ SpComposablePresenterWithModelTest >> testUpdateModel [ { #category : #testing } SpComposablePresenterWithModelTest >> testUpdateModelWithValueHolder [ - | aPoint aValueHolder presenter anAnnouncer | - "create a point and a value holder that contains it and can react on announcements" - aPoint := 40@54. + aPoint := 40 @ 54. aValueHolder := NewValueHolder value: aPoint. - - self assert: (aValueHolder value == aPoint). + + self assert: aValueHolder value identicalTo: aPoint. anAnnouncer := aValueHolder announcer. - self assert: (aValueHolder announcer subscriptions subscriptions size) equals: 0. - + self assert: aValueHolder announcer subscriptions subscriptions size equals: 0. + presenter := SpTestingPresenterWithModel on: aValueHolder. - self assert: (anAnnouncer == aValueHolder announcer). + self assert: anAnnouncer identicalTo: aValueHolder announcer. self assert: presenter x text equals: aPoint x asString. self assert: presenter y text equals: aPoint y asString. - + aPoint setX: 1 setY: 2. - self assert: (aValueHolder value == aPoint). + self assert: aValueHolder value identicalTo: aPoint. aValueHolder valueChanged. - self assert: (anAnnouncer == aValueHolder announcer). - + self assert: anAnnouncer identicalTo: aValueHolder announcer. + "the point itself is not subscribed to the presenter" self assert: presenter x text equals: aPoint x asString. - self assert: presenter y text equals: aPoint y asString. - - - + self assert: presenter y text equals: aPoint y asString ] diff --git a/src/Spec2-Tests/SpInterpreterTest.class.st b/src/Spec2-Tests/SpInterpreterTest.class.st index 1a0e0ecbf86..1b2f415caa3 100644 --- a/src/Spec2-Tests/SpInterpreterTest.class.st +++ b/src/Spec2-Tests/SpInterpreterTest.class.st @@ -61,7 +61,7 @@ SpInterpreterTest >> testInterpretASpecModelMorphAssociation [ model := SpAbstractWidgetPresenter new. spec := {#MenuRegistration . #help: . #icon:}. morph := specInterpreterClass interpretASpec: spec presenter: model. - self assert: model adapter == morph + self assert: model adapter identicalTo: morph ] { #category : #tests } diff --git a/src/Spec2-Tests/SpSliderPresenterTest.class.st b/src/Spec2-Tests/SpSliderPresenterTest.class.st index a009b990257..cc66d9fb9db 100644 --- a/src/Spec2-Tests/SpSliderPresenterTest.class.st +++ b/src/Spec2-Tests/SpSliderPresenterTest.class.st @@ -19,7 +19,7 @@ SpSliderPresenterTest >> initMinMax [ SpSliderPresenterTest >> testAbsoluteValue [ self initMinMax. presenter absoluteValue: 0.5. - self assert: presenter value == 50 + self assert: presenter value identicalTo: 50 ] { #category : #tests } @@ -34,7 +34,7 @@ SpSliderPresenterTest >> testReset [ presenter value: 50; reset. - self assert: presenter value == 0 + self assert: presenter value identicalTo: 0 ] { #category : #tests } diff --git a/src/System-Identification-Tests/GlobalIdentifierMergerTest.class.st b/src/System-Identification-Tests/GlobalIdentifierMergerTest.class.st index 007a5203f8e..fff45757625 100644 --- a/src/System-Identification-Tests/GlobalIdentifierMergerTest.class.st +++ b/src/System-Identification-Tests/GlobalIdentifierMergerTest.class.st @@ -34,33 +34,34 @@ GlobalIdentifierMergerTest >> testMerge [ { #category : #tests } GlobalIdentifierMergerTest >> testMerge2 [ "Existing has something. Stored has another key." + existing at: #a put: 42. stored at: #b put: 21. self assert: merger merge. - self deny: existing = stored. + self deny: existing equals: stored. self assert: existing size equals: 2. self assert: stored size equals: 1. self assert: (existing at: #a) equals: 42. - self assert: (existing at: #b) equals: 21. - + self assert: (existing at: #b) equals: 21 ] { #category : #tests } GlobalIdentifierMergerTest >> testMerge3 [ "Existing has same key as stored." + existing at: #a put: 42. stored at: #a put: 21. self deny: merger merge. - self deny: existing = stored. + self deny: existing equals: stored. self assert: existing size equals: 1. self assert: stored size equals: 1. - self assert: (existing at: #a) equals: 42. - + self assert: (existing at: #a) equals: 42 ] { #category : #tests } GlobalIdentifierMergerTest >> testMerge4 [ "Existing has different computer id as stored." + existing at: #computerUUID put: 42. existing at: #a put: 43. existing at: #c put: 44. @@ -68,70 +69,69 @@ GlobalIdentifierMergerTest >> testMerge4 [ stored at: #b put: 22. stored at: #c put: 23. self assert: merger merge. - self deny: existing = stored. + self deny: existing equals: stored. self assert: existing size equals: 4. self assert: stored size equals: 3. self assert: (existing at: #computerUUID) equals: 21 asString. self assert: (existing at: #a) equals: 43. self assert: (existing at: #b) equals: 22. - self assert: (existing at: #c) equals: 23. - + self assert: (existing at: #c) equals: 23 ] { #category : #tests } GlobalIdentifierMergerTest >> testMerge5 [ "Existing has different computer id as stored." + existing at: #computerUUID put: 42. existing at: #a put: 43. existing at: #c put: 44. stored at: #b put: 22. stored at: #c put: 23. self assert: merger merge. - self deny: existing = stored. + self deny: existing equals: stored. self assert: existing size equals: 4. self assert: stored size equals: 2. self assert: (existing at: #computerUUID) equals: 42 asString. self assert: (existing at: #a) equals: 43. self assert: (existing at: #b) equals: 22. - self assert: (existing at: #c) equals: 44. - + self assert: (existing at: #c) equals: 44 ] { #category : #tests } GlobalIdentifierMergerTest >> testMerge6 [ "Existing has different computer id as stored." + existing at: #a put: 43. existing at: #c put: 44. stored at: #computerUUID put: 21. stored at: #b put: 22. stored at: #c put: 23. self assert: merger merge. - self deny: existing = stored. + self deny: existing equals: stored. self assert: existing size equals: 4. self assert: stored size equals: 3. self assert: (existing at: #computerUUID) equals: 21 asString. self assert: (existing at: #a) equals: 43. self assert: (existing at: #b) equals: 22. - self assert: (existing at: #c) equals: 23. - + self assert: (existing at: #c) equals: 23 ] { #category : #tests } GlobalIdentifierMergerTest >> testMerge7 [ "Ensure that it converts computerUUID into string." + stored at: #computerUUID put: UUID new. self assert: merger merge. - self deny: existing = stored. - self assert: (existing at: #computerUUID) equals: (stored at: #computerUUID) asString. - + self deny: existing equals: stored. + self assert: (existing at: #computerUUID) equals: (stored at: #computerUUID) asString ] { #category : #tests } GlobalIdentifierMergerTest >> testMerge8 [ "Ensure that it converts secretUUID into string." + stored at: #secretUUID put: UUID new. self assert: merger merge. - self deny: existing = stored. - self assert: (existing at: #secretUUID) equals: (stored at: #secretUUID) asString. - + self deny: existing equals: stored. + self assert: (existing at: #secretUUID) equals: (stored at: #secretUUID) asString ] diff --git a/src/System-Identification-Tests/GlobalIdentifierTest.class.st b/src/System-Identification-Tests/GlobalIdentifierTest.class.st index 68a3aaac6c2..a275abd4d04 100644 --- a/src/System-Identification-Tests/GlobalIdentifierTest.class.st +++ b/src/System-Identification-Tests/GlobalIdentifierTest.class.st @@ -57,29 +57,39 @@ GlobalIdentifierTest >> testBackwardCompatibility [ "Let's say that we have information stored using FUEL, but we use STON. We do not have any STON stored value. Let's check that we load the FUEL, then stores it as STON." - | fuelPersistence fuelPrefereces fuelDictionary | + + | fuelPersistence fuelPrefereces fuelDictionary | fuelPersistence := GlobalIdentifierPersistence fuel. - fuelPersistence checker: (self newChecker answer: [ FileLocator workingDirectory exists ]; yourself). + fuelPersistence + checker: + (self newChecker + answer: [ FileLocator workingDirectory exists ]; + yourself). fuelPrefereces := preferences parent / 'old-preferences.fuel'. fuelPersistence preferences: fuelPrefereces. fuelDictionary := Dictionary new. fuelDictionary at: #computerUUID put: 42. fuelPersistence save: fuelDictionary. identifier persistenceStrategy previous: fuelPersistence. - self deny: identifier computerUUID = 42. + self deny: identifier computerUUID equals: 42. self assert: fuelPersistence preferences exists. identifier ensure. self assert: identifier computerUUID equals: 42 asString. - self assert: identifier persistenceStrategy preferences exists. + self assert: identifier persistenceStrategy preferences exists ] { #category : #tests } GlobalIdentifierTest >> testBackwardCompatibility2 [ "Let's say that we have information stored using both FUEL and STON, and we use STON. We will ingnore FUEL file and load STON." - | fuelPersistence fuelPrefereces fuelDictionary stonDictionary | + + | fuelPersistence fuelPrefereces fuelDictionary stonDictionary | fuelPersistence := GlobalIdentifierPersistence fuel. - fuelPersistence checker: (self newChecker answer: [ FileLocator workingDirectory exists ]; yourself). + fuelPersistence + checker: + (self newChecker + answer: [ FileLocator workingDirectory exists ]; + yourself). fuelPrefereces := preferences parent / 'old-preferences.fuel'. fuelPersistence preferences: fuelPrefereces. fuelDictionary := Dictionary new. @@ -89,13 +99,12 @@ GlobalIdentifierTest >> testBackwardCompatibility2 [ stonDictionary := Dictionary new. stonDictionary at: #computerUUID put: 21. identifier persistenceStrategy save: stonDictionary. - self deny: identifier computerUUID = 42. - self deny: identifier computerUUID = 21. + self deny: identifier computerUUID equals: 42. + self deny: identifier computerUUID equals: 21. self assert: fuelPersistence preferences exists. self assert: identifier persistenceStrategy preferences exists. identifier ensure. - self assert: identifier computerUUID equals: 21 asString. - + self assert: identifier computerUUID equals: 21 asString ] { #category : #tests } @@ -126,9 +135,14 @@ GlobalIdentifierTest >> testBackwardCompatibility4 [ "Let's say that we have information stored using FUEL but we cannot read the file. We use STON. The STON preference file is broken, we cannot read it. Let's check that we keep FUEL file untouched and creates STON file." + | fuelPersistence fuelPrefereces data dictionary | fuelPersistence := GlobalIdentifierPersistence fuel. - fuelPersistence checker: (self newChecker answer: [ FileLocator workingDirectory exists ]; yourself). + fuelPersistence + checker: + (self newChecker + answer: [ FileLocator workingDirectory exists ]; + yourself). fuelPrefereces := preferences parent / 'old-preferences.fuel'. fuelPrefereces parent ensureCreateDirectory. data := 'some data'. @@ -146,10 +160,10 @@ GlobalIdentifierTest >> testBackwardCompatibility4 [ self assert: fuelPrefereces exists. self assert: fuelPrefereces contents equals: data. self assert: identifier persistenceStrategy preferences exists. - self deny: identifier persistenceStrategy preferencesContents = data. + self deny: identifier persistenceStrategy preferencesContents equals: data. dictionary := Dictionary new. identifier persistenceStrategy load: dictionary. - self assert: dictionary equals: identifier persistedInformation. + self assert: dictionary equals: identifier persistedInformation ] { #category : #tests } diff --git a/src/System-Support-Tests/SystemDictionaryTest.class.st b/src/System-Support-Tests/SystemDictionaryTest.class.st index 7b37c3ffa45..1d664bb18ba 100644 --- a/src/System-Support-Tests/SystemDictionaryTest.class.st +++ b/src/System-Support-Tests/SystemDictionaryTest.class.st @@ -27,16 +27,14 @@ SystemDictionaryTest >> classToBeTested [ { #category : #tests } SystemDictionaryTest >> testClassOrTraitNamedReturnsClassForClasses [ - - self assert: Object == (testingEnvironment classOrTraitNamed: 'Object'). - self assert: Object == (testingEnvironment classOrTraitNamed: #Object). + self assert: Object identicalTo: (testingEnvironment classOrTraitNamed: 'Object'). + self assert: Object identicalTo: (testingEnvironment classOrTraitNamed: #Object) ] { #category : #tests } SystemDictionaryTest >> testClassOrTraitNamedReturnsNilForGlobals [ - - self assert: nil = (testingEnvironment classOrTraitNamed: 'Undeclared'). - self assert: nil = (testingEnvironment classOrTraitNamed: #Undeclared). + self assert: nil equals: (testingEnvironment classOrTraitNamed: 'Undeclared'). + self assert: nil equals: (testingEnvironment classOrTraitNamed: #Undeclared) ] { #category : #tests } @@ -50,22 +48,20 @@ SystemDictionaryTest >> testEnvironmentOfOrganization [ { #category : #tests } SystemDictionaryTest >> testOrganizationPerInstance [ - - | aDictionary otherDictionary | + | aDictionary otherDictionary | aDictionary := SystemDictionary withOrganizer: SystemOrganizer new. otherDictionary := SystemDictionary withOrganizer: SystemOrganizer new. - self deny: aDictionary organization = otherDictionary organization. - + self deny: aDictionary organization equals: otherDictionary organization ] { #category : #tests } SystemDictionaryTest >> testOtherInstancesOfSystemDictionaryAsString [ - self deny: SystemDictionary new asString = 'Smalltalk' + self deny: SystemDictionary new asString equals: 'Smalltalk' ] { #category : #tests } SystemDictionaryTest >> testOtherInstancesOfSystemDictionaryPrintString [ - self deny: SystemDictionary new printString = 'Smalltalk' + self deny: SystemDictionary new printString equals: 'Smalltalk' ] { #category : #tests } @@ -75,24 +71,22 @@ SystemDictionaryTest >> testOtherInstancesOfSystemDictionarySelfEvaluating [ { #category : #tests } SystemDictionaryTest >> testSetOrganizationSetBackPointer [ - | sd so | sd := SystemDictionary new. so := SystemOrganizer new. sd organization: so. - self assert: so environment == sd. - self assert: sd organization == so - + self assert: so environment identicalTo: sd. + self assert: sd organization identicalTo: so ] { #category : #tests } SystemDictionaryTest >> testSmalltalkAsString [ - self assert: Smalltalk asString = 'Smalltalk' + self assert: Smalltalk asString equals: 'Smalltalk' ] { #category : #tests } SystemDictionaryTest >> testSmalltalkPrintString [ - self assert: Smalltalk printString = 'Smalltalk' + self assert: Smalltalk printString equals: 'Smalltalk' ] { #category : #tests } diff --git a/src/System-Support-Tests/SystemNavigationTest.class.st b/src/System-Support-Tests/SystemNavigationTest.class.st index 753850116ba..28934e2ac80 100644 --- a/src/System-Support-Tests/SystemNavigationTest.class.st +++ b/src/System-Support-Tests/SystemNavigationTest.class.st @@ -123,26 +123,24 @@ SystemNavigationTest >> testIsMessageSentInSystemAnswersMethodReference [ { #category : #testing } SystemNavigationTest >> testIsMessageSentInSystemWithClassesActuallySendngTheMessage [ - | classesSendingMessage sentMessageSelector| + | classesSendingMessage sentMessageSelector | sentMessageSelector := 'MessageSentOnlyByTestClassesXXXShouldNotBeRealyDefined' asSymbol. - 5 timesRepeat: [self classFactory newClassInCategory: #One]. - 5 timesRepeat: [self classFactory newClassInCategory: #Two]. - classesSendingMessage := (self classFactory createdClasses asArray first: 2), (self classFactory createdClasses asArray last: 3). - classesSendingMessage do: [:class| - class compileSilently: 'meth self ', sentMessageSelector]. - self assert: (self systemNavigationToTest allSendersOf: sentMessageSelector) size = 5 + 5 timesRepeat: [ self classFactory newClassInCategory: #One ]. + 5 timesRepeat: [ self classFactory newClassInCategory: #Two ]. + classesSendingMessage := (self classFactory createdClasses asArray first: 2) , (self classFactory createdClasses asArray last: 3). + classesSendingMessage do: [ :class | class compileSilently: 'meth self ' , sentMessageSelector ]. + self assert: (self systemNavigationToTest allSendersOf: sentMessageSelector) size equals: 5 ] { #category : #testing } SystemNavigationTest >> testIsMessageSentInSystemWithTheSelectorInsideAnArray [ | classesSendingMessage sentMessageSelector | sentMessageSelector := 'MessageSentOnlyByTestClassesXXXShouldNotBeRealyDefined' asSymbol. - 5 timesRepeat: [self classFactory newClassInCategory: #One]. - 5 timesRepeat: [self classFactory newClassInCategory: #Two]. - classesSendingMessage := (self classFactory createdClasses asArray first: 2), (self classFactory createdClasses asArray last: 3). - classesSendingMessage do: [:class| - class compileSilently: 'meth ^#(a b ', sentMessageSelector, ' c)']. - self assert: (self systemNavigationToTest allSendersOf: sentMessageSelector) size = 5 + 5 timesRepeat: [ self classFactory newClassInCategory: #One ]. + 5 timesRepeat: [ self classFactory newClassInCategory: #Two ]. + classesSendingMessage := (self classFactory createdClasses asArray first: 2) , (self classFactory createdClasses asArray last: 3). + classesSendingMessage do: [ :class | class compileSilently: 'meth ^#(a b ' , sentMessageSelector , ' c)' ]. + self assert: (self systemNavigationToTest allSendersOf: sentMessageSelector) size equals: 5 ] { #category : #testing } diff --git a/src/System-Support-Tests/SystemOrganizerTest.class.st b/src/System-Support-Tests/SystemOrganizerTest.class.st index a11a6d6b8d4..216ca42f513 100644 --- a/src/System-Support-Tests/SystemOrganizerTest.class.st +++ b/src/System-Support-Tests/SystemOrganizerTest.class.st @@ -9,15 +9,14 @@ Class { { #category : #tests } SystemOrganizerTest >> testDefault [ - - self assert: (SystemOrganizer default == self class environment organization). + self assert: SystemOrganizer default identicalTo: self class environment organization ] { #category : #tests } SystemOrganizerTest >> testDefaultEnvironment [ "When no environment is specified, point to the default one" - - self assert: (SystemOrganizer new environment == Smalltalk globals) + + self assert: SystemOrganizer new environment identicalTo: Smalltalk globals ] { #category : #tests }