• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mattonem / PharoJS / 14220696386

11 Mar 2025 04:04PM UTC coverage: 42.026% (-17.4%) from 59.444%
14220696386

push

github

mattonem
more catching

1 of 1 new or added line in 1 file covered. (100.0%)

3707 existing lines in 69 files now uncovered.

8909 of 21199 relevant lines covered (42.03%)

0.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Pharo/PharoJs-Base-JS-CoreLibraries-Tests/PjIdentityDictionaryTest.class.st
1
Class {
2
        #name : 'PjIdentityDictionaryTest',
3
        #superclass : 'PjBridgeTestCase',
4
        #category : 'PharoJs-Base-JS-CoreLibraries-Tests-Collections',
5
        #package : 'PharoJs-Base-JS-CoreLibraries-Tests',
6
        #tag : 'Collections'
7
}
8

9
{ #category : 'tests' }
UNCOV
10
PjIdentityDictionaryTest >> testAsDictionary [
×
UNCOV
11
        | original asDictResult |
×
UNCOV
12
        original := self bridge evalBlock: [ IdentityDictionary new].
×
UNCOV
13
        original 
×
UNCOV
14
                at: #a put: 1;
×
UNCOV
15
                at: #b put: 2.
×
UNCOV
16
        asDictResult := original asDictionary.
×
UNCOV
17
        self assert: original == asDictResult
×
UNCOV
18
]
×
19

20
{ #category : 'tests' }
UNCOV
21
PjIdentityDictionaryTest >> testAtIfAbsent [
×
UNCOV
22
        self assertEquivalent: [|d|
×
UNCOV
23
                d := IdentityDictionary new.
×
UNCOV
24
                d at: #x ifAbsent: [42]].
×
UNCOV
25
]
×
26

27
{ #category : 'tests' }
UNCOV
28
PjIdentityDictionaryTest >> testAtIfAbsentPut [
×
UNCOV
29
        self assertEquivalent: [|d|
×
UNCOV
30
                d := IdentityDictionary new.
×
UNCOV
31
                d at: #x ifAbsentPut: 42.
×
UNCOV
32
                d at: #x].
×
UNCOV
33
        self assertEquivalent: [|d|
×
UNCOV
34
                d := IdentityDictionary new.
×
UNCOV
35
                d at: #x ifAbsentPut: [42].
×
UNCOV
36
                d at: #x].
×
UNCOV
37
]
×
38

39
{ #category : 'tests' }
UNCOV
40
PjIdentityDictionaryTest >> testAtIfEmpty [
×
UNCOV
41
        self assertEquivalent: [ IdentityDictionary new isEmpty ].
×
UNCOV
42
        self assertEquivalent: [ (IdentityDictionary new at: #x put: 4;yourself) isEmpty ].
×
UNCOV
43
        self assertEquivalent: [|d|
×
UNCOV
44
                d := IdentityDictionary new.
×
UNCOV
45
                d ifEmpty: [ 3 ]].
×
UNCOV
46
        self assertEquivalent: [|d|
×
UNCOV
47
                d := IdentityDictionary new.
×
UNCOV
48
                d ifEmpty: [ 3 ] ifNotEmpty: [42]].
×
UNCOV
49
        self assertEquivalent: [|d|
×
UNCOV
50
                d := IdentityDictionary new.
×
UNCOV
51
                d ifNotEmpty: [ 3 ] ifEmpty: [42]].
×
UNCOV
52
        self assertEquivalent: [|d t|
×
UNCOV
53
                d := IdentityDictionary new.t:=5.
×
UNCOV
54
                d at: #x put: 4.
×
UNCOV
55
                d ifEmpty: [ t:=3 ].t].
×
UNCOV
56
        self assertEquivalent: [|d|
×
UNCOV
57
                d := IdentityDictionary new.
×
UNCOV
58
                d at: #x put: 4.
×
UNCOV
59
                d ifEmpty: [ 3 ] ifNotEmpty: [42]].
×
UNCOV
60
        self assertEquivalent: [|d|
×
UNCOV
61
                d := IdentityDictionary new.
×
UNCOV
62
                d at: #x put: 4.
×
UNCOV
63
                d ifNotEmpty: [ 3 ] ifEmpty: [42]].
×
UNCOV
64
]
×
65

66
{ #category : 'tests' }
UNCOV
67
PjIdentityDictionaryTest >> testAtPut [
×
UNCOV
68
        self assertEquivalent: [|d|
×
UNCOV
69
                d := IdentityDictionary new.
×
UNCOV
70
                d at: #x put: 42.
×
UNCOV
71
                d at: #x].
×
UNCOV
72
        self assertEquivalent: [|d|
×
UNCOV
73
                d := IdentityDictionary new.
×
UNCOV
74
                d at: #x put: 42.
×
UNCOV
75
                d size]
×
UNCOV
76
]
×
77

78
{ #category : 'tests' }
UNCOV
79
PjIdentityDictionaryTest >> testKeysAndValuesDo [
×
UNCOV
80
        | dict |
×
UNCOV
81
        dict := self bridge
×
UNCOV
82
                evalBlock: [ 
×
UNCOV
83
                        IdentityDictionary new
×
UNCOV
84
                                at: #a put: 3;
×
UNCOV
85
                                at: #b put: 5;
×
UNCOV
86
                                at: #c put: 42;
×
UNCOV
87
                                yourself ].
×
UNCOV
88
        self
×
UNCOV
89
                assert: [ | count |
×
UNCOV
90
                        count := 0.
×
UNCOV
91
                        dict keysAndValuesDo: [ :k :v | count := count + v ].
×
UNCOV
92
                        count ]
×
UNCOV
93
                evaluatesTo: 50.
×
UNCOV
94
        self
×
UNCOV
95
                assert: [ | count |
×
UNCOV
96
                        count := 0.
×
UNCOV
97
                        dict do: [ :v | count := count + v ].
×
UNCOV
98
                        count ]
×
UNCOV
99
                evaluatesTo: 50.
×
UNCOV
100
        self assert: [ dict isEmpty ] evaluatesTo: false.
×
UNCOV
101
        self assert: [ IdentityDictionary new isEmpty ] evaluatesTo: true
×
UNCOV
102
]
×
103

104
{ #category : 'tests' }
UNCOV
105
PjIdentityDictionaryTest >> testNewFromPairs [
×
UNCOV
106
        | d |
×
UNCOV
107
        d := self bridge
×
UNCOV
108
                evalBlock: [ IdentityDictionary newFromPairs: #(#x 17 #y 42) ].
×
UNCOV
109
]
×
110

111
{ #category : 'tests' }
UNCOV
112
PjIdentityDictionaryTest >> testNonInterference [
×
UNCOV
113
        " make sure dictionary emulation doesn't interfere "
×
UNCOV
114
        self assert: [document body classList add: 'hello'] evaluatesTo: nil.
×
UNCOV
115
        self assert: [document body classList contains: 'hello'] evaluatesTo: true
×
UNCOV
116
]
×
117

118
{ #category : 'tests' }
UNCOV
119
PjIdentityDictionaryTest >> testUseObjectsAsKeysForIdentityDictionary [
×
UNCOV
120
        self assert: [
×
UNCOV
121
                |dict firstKey secondKey| 
×
UNCOV
122
                dict := IdentityDictionary new.
×
UNCOV
123
                firstKey :=  PjObjectForDictTest data: 1.
×
UNCOV
124
                dict at: firstKey put: 'A'.
×
UNCOV
125
                secondKey := PjObjectForDictTest data: 1.
×
UNCOV
126
                dict at: secondKey put: 'B'.
×
UNCOV
127
                dict at: firstKey
×
UNCOV
128
        ] evaluatesTo: 'A'.
×
UNCOV
129
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc