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

mattonem / PharoJS / 14084350551

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

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/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' }
UNCOV
10
PjObjectTest >> assert: parent andChild: child hasOrInheritProperty: ivName [
×
UNCOV
11
        | objects |
×
UNCOV
12
        child  instVarNamed: #'__proto__' put: parent. 
×
UNCOV
13
        objects := { parent. child }.
×
UNCOV
14
        objects do: [: each | self deny: (each hasOrInheritsProperty: ivName)].
×
UNCOV
15
        parent instVarNamed: ivName put: nil.
×
UNCOV
16
        objects do: [: each | self assert: (each hasOrInheritsProperty: ivName)].
×
UNCOV
17

×
UNCOV
18
]
×
19

20
{ #category : 'tests' }
UNCOV
21
PjObjectTest >> testClassHasOrInheritProperty [
×
UNCOV
22
        | jsObject jsArray |
×
UNCOV
23
        jsArray := self evalBlock: [ Array ].
×
UNCOV
24
        jsObject := self evalBlock: [ Object ].
×
UNCOV
25
        self assertBlock: [jsArray superclass == jsObject].
×
UNCOV
26
        self assert: jsObject andChild: jsArray hasOrInheritProperty: #classIV.
×
UNCOV
27
        
×
UNCOV
28
        
×
UNCOV
29
]
×
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' }
UNCOV
38
PjObjectTest >> testObjectHasOrInheritProperty [
×
UNCOV
39
        | parent child |
×
UNCOV
40
        parent := self evalBlock: [ Object new ].
×
UNCOV
41
        child :=  self evalBlock: [ Object new ].
×
UNCOV
42
        self assert: parent andChild: child hasOrInheritProperty: #instanceIV.
×
UNCOV
43
        
×
UNCOV
44
]
×
45

46
{ #category : 'tests' }
UNCOV
47
PjObjectTest >> testPrintStringArray [
×
UNCOV
48

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

70
{ #category : 'tests' }
UNCOV
71
PjObjectTest >> testPrintStringBasicCases [
×
UNCOV
72

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

89
{ #category : 'tests' }
UNCOV
90
PjObjectTest >> testPrintStringException [
×
UNCOV
91

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

106
{ #category : 'tests' }
UNCOV
107
PjObjectTest >> testPrintStringNumbers [
×
UNCOV
108

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

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