Skip to content

Commit

Permalink
Improved PjDictionaryTest >> #testAtPut
Browse files Browse the repository at this point in the history
  • Loading branch information
bouraqadi committed Oct 30, 2024
1 parent 1e6851f commit cf400af
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions Pharo/PharoJs-Base-JS-CoreLibraries-Tests/PjDictionaryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,25 @@ PjDictionaryTest >> testAtIfEmpty [

{ #category : 'tests' }
PjDictionaryTest >> testAtPut [
self assertEquivalent: [|d|
d := Dictionary new.
d at: #x put: 42.
d at: #x].
| dict key1 value1 key2 value2 key3 value3 |
self assert: [|d|
d := Dictionary new.
d at: #x put: 42.
d] evaluatesToRaw: '{"x":42}'.
self assert: [|d|
d := Dictionary new.
d at: (1@1) put: '42'.
d at: (1@1)] evaluatesToRaw: '42'.
self assert: [|d|
d := Dictionary new.
d at: Object put: '42'.
d at: Object] evaluatesToRaw: '42'
dict := self evalBlock: [Dictionary new].
key1 := self evalBlock: [ 1@1 ].
value1 := 'my first point'.
key2 := self evalBlock: [ Object ].
value2 := 42.
key3 := #x.
value3 := self evalBlock: [ Object new ].
dict at: key1 put: value1.
dict at: key2 put: value2.
dict at: key3 put: value3.
self assert: (dict at: key1) equals: value1.
self assert: (dict at: key2) equals: value2.
self assert: (dict at: key3) equals: value3

]

{ #category : 'tests' }
Expand Down

0 comments on commit cf400af

Please sign in to comment.