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

mattonem / PharoJS / 13788456566

11 Mar 2025 12:50PM UTC coverage: 62.432% (+4.5%) from 57.928%
13788456566

push

github

mattonem
typo

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

63 existing lines in 4 files now uncovered.

13233 of 21196 relevant lines covered (62.43%)

0.62 hits per line

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

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

9
{ #category : 'tests' }
10
PjObjectTest >> assert: parent andChild: child hasOrInheritProperty: ivName [
1✔
11
        | objects |
1✔
12
        child  instVarNamed: #'__proto__' put: parent. 
1✔
13
        objects := { parent. child }.
1✔
14
        objects do: [: each | self deny: (each hasOrInheritsProperty: ivName)].
1✔
15
        parent instVarNamed: ivName put: nil.
1✔
16
        objects do: [: each | self assert: (each hasOrInheritsProperty: ivName)].
1✔
17

1✔
18
]
1✔
19

20
{ #category : 'tests' }
21
PjObjectTest >> testClassHasOrInheritProperty [
1✔
22
        | jsObject jsArray |
1✔
23
        jsArray := self evalBlock: [ Array ].
1✔
24
        jsObject := self evalBlock: [ Object ].
1✔
25
        self assertBlock: [jsArray superclass == jsObject].
1✔
26
        self assert: jsObject andChild: jsArray hasOrInheritProperty: #classIV.
1✔
27
        
1✔
28
        
1✔
29
]
1✔
30

31
{ #category : 'tests' }
UNCOV
32
PjObjectTest >> testNewObjectHasNoEnumeratableKeys [
×
UNCOV
33
        "This is important for many JS third party libraries"
×
UNCOV
34
        self assertBlock: [ Object new allEnumeratableKeys isEmpty ] .
×
UNCOV
35
]
×
36

37
{ #category : 'tests' }
38
PjObjectTest >> testObjectHasOrInheritProperty [
1✔
39
        | parent child |
1✔
40
        parent := self evalBlock: [ Object new ].
1✔
41
        child :=  self evalBlock: [ Object new ].
1✔
42
        self assert: parent andChild: child hasOrInheritProperty: #instanceIV.
1✔
43
        
1✔
44
]
1✔
45

46
{ #category : 'tests' }
47
PjObjectTest >> testPrintStringArray [
1✔
48

1✔
49
        self
1✔
50
                assert: [ #( 1 2 3 nil true #nil #symbol ) printString ]
1✔
51
                evaluatesTo: '#(1 2 3 nil true ''nil'' ''symbol'')'.
1✔
52
        self
1✔
53
                assert: [ 
1✔
54
                #( #( 1 2 3 nil ) #(  ) #( true #nil #symbol ) ) printString ]
1✔
55
                evaluatesTo: '#(#(1 2 3 nil) #() #(true ''nil'' ''symbol''))'.
1✔
56
        self
1✔
57
                assert: [ 
1✔
58
                        { 
1✔
59
                                Object new.
1✔
60
                                #( true nil ).
1✔
61
                                nil.
1✔
62
                                12.4.
1✔
63
                                #someSymbol.
1✔
64
                                (true and: [ false ]).
1✔
65
                                [ 42 factorial ] } printString ]
1✔
66
                evaluatesTo:
1✔
67
                'an Array(an Object #(true nil) nil 12.4 ''someSymbol'' false a Block)'
1✔
68
]
1✔
69

70
{ #category : 'tests' }
71
PjObjectTest >> testPrintStringBasicCases [
1✔
72

1✔
73
        self assert: [ Object new printString ] evaluatesTo: 'an Object'.
1✔
74
        self assert: [ PjSet new printString ] evaluatesTo: 'a PjSet()'.
1✔
75
        self
1✔
76
                assert: [ 'hello world' printString ]
1✔
77
                evaluatesTo: '''hello world'''.
1✔
78
        self
1✔
79
                assert: [ 'DragN''Drop' printString ]
1✔
80
                evaluatesTo: '''DragN''''Drop'''.
1✔
81
        self assert: [ true printString ] evaluatesTo: 'true'.
1✔
82
        self assert: [ false printString ] evaluatesTo: 'false'.
1✔
83
        self assert: [ nil printString ] evaluatesTo: 'nil'.
1✔
84
        self
1✔
85
                assert: [ #someSymbol printString ]
1✔
86
                evaluatesTo: '''someSymbol'''
1✔
87
]
1✔
88

89
{ #category : 'tests' }
90
PjObjectTest >> testPrintStringException [
1✔
91

1✔
92
        { 
1✔
93
                Error.
1✔
94
                ZeroDivide } do: [ :exceptionClass | 
1✔
95
                self
1✔
96
                        assert: [ exceptionClass new description ]
1✔
97
                        evaluatesTo: exceptionClass name.
1✔
98
                self
1✔
99
                        assert: [ 
1✔
100
                                exceptionClass new
1✔
101
                                        messageText: 'Some cause';
1✔
102
                                        description ]
1✔
103
                        evaluatesTo: exceptionClass name , ': Some cause' ]
1✔
104
]
1✔
105

106
{ #category : 'tests' }
107
PjObjectTest >> testPrintStringNumbers [
1✔
108

1✔
109
        self assert: [ 123 printString ] evaluatesTo: '123'.
1✔
110
        self
1✔
111
                assert: [ Float infinity printString ]
1✔
112
                evaluatesTo: 'Float infinity'.
1✔
113
        self
1✔
114
                assert: [ Float nan printString ]
1✔
115
                evaluatesTo: 'Float nan'.
1✔
116
]
1✔
117

118
{ #category : 'tests' }
119
PjObjectTest >> testShallowCopy [
1✔
120
        self assertBlock: [
1✔
121
                |original clone|
1✔
122
                original := Object new.
1✔
123
                original instVarNamed: #a put: 1. 
1✔
124
                clone := original copy.
1✔
125
                clone class == Object and: [ (clone instVarNamed: #a) = 1 ]
1✔
126
                 ]
1✔
127
]
1✔
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