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

mattonem / PharoJS / 13792209801

11 Mar 2025 03:41PM UTC coverage: 59.444% (-3.0%) from 62.432%
13792209801

push

github

mattonem
better

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

751 existing lines in 18 files now uncovered.

12601 of 21198 relevant lines covered (59.44%)

0.59 hits per line

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

72.06
/Pharo/PharoJs-Base-JS-CoreLibraries-Tests/PjStringTest.class.st
1
Class {
2
        #name : 'PjStringTest',
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
PjStringTest >> testConversion [
×
UNCOV
11
        self assertEquivalent: ['the Eiffel Tower' asUppercase].
×
UNCOV
12
        self assertEquivalent: ['the Eiffel Tower' asLowercase].
×
UNCOV
13
        self assertEquivalent: ['the Eiffel Tower' capitalized].
×
UNCOV
14
]
×
15

16
{ #category : 'tests' }
17
PjStringTest >> testConversionToNumbers [
1✔
18
        self assertEquivalent: ['07' asInteger].
1✔
19
        self assertEquivalent: ['3.14' asInteger].
1✔
20
        self assertEquivalent: ['3.14' asNumber].
1✔
21
        self assertEquivalent: ['2xyz' asNumber].
1✔
22
        self assertEquivalent: ['1.41xyz' asNumber].
1✔
23
]
1✔
24

25
{ #category : 'tests' }
26
PjStringTest >> testFirst [
1✔
27
        self assert: ['abc' first] evaluatesTo: 'a'.
1✔
28
        self assert: ['CBA' first] evaluatesTo: 'C'.
1✔
29
]
1✔
30

31
{ #category : 'tests' }
UNCOV
32
PjStringTest >> testIfEmpty [
×
UNCOV
33
        self assertEquivalent: ['abc' ifEmpty: ['xyz']].
×
UNCOV
34
        self assertEquivalent: ['' ifEmpty: ['xyz']].
×
UNCOV
35
]
×
36

37
{ #category : 'tests' }
UNCOV
38
PjStringTest >> testIsAlphanumeric [
×
UNCOV
39
        | digits |
×
UNCOV
40
        digits := Character allByteCharacters select: [: each | each isAlphaNumeric ].
×
UNCOV
41
        self assertBlock: [digits allSatisfy: [: char |char isAlphaNumeric ]].
×
UNCOV
42
]
×
43

44
{ #category : 'tests' }
45
PjStringTest >> testIsDigit [
1✔
46
        | digits |
1✔
47
        digits := Character allByteCharacters select: [: each | each isDigit].
1✔
48
        self assertBlock: [digits allSatisfy: [: char |char isDigit]].
1✔
49
]
1✔
50

51
{ #category : 'tests' }
52
PjStringTest >> testIsLetter [
1✔
53
        | letters nonLetters |
1✔
54
        letters := Character allByteCharacters select: [: each | each isLetter].
1✔
55
        self assertBlock: [letters allSatisfy: [: char |char isLetter]].
1✔
56
        nonLetters := Character allByteCharacters copyWithoutAll: letters.
1✔
57
        self assertBlock: [nonLetters noneSatisfy: [: char |  char isLetter]].
1✔
58
]
1✔
59

60
{ #category : 'tests' }
61
PjStringTest >> testLast [
1✔
62
        self assert: ['abc' last] evaluatesTo: 'c'.
1✔
63
        self assert: ['CBA' last] evaluatesTo: 'A'.
1✔
64
]
1✔
65

66
{ #category : 'tests' }
67
PjStringTest >> testReversed [
1✔
68
        self
1✔
69
                assertEquivalent: ['abcd' reversed].
1✔
70
]
1✔
71

72
{ #category : 'tests' }
73
PjStringTest >> testSplit [
1✔
74
        | splited |
1✔
75
        splited := self evalBlock: ['.' split: 'a.b.c'].
1✔
76
        self assert: splited size equals: 3.
1✔
77
        #(a b c) withIndexDo: [ : expected : index | 
1✔
78
                self assert: (splited at: index) equals: expected]
1✔
79
]
1✔
80

81
{ #category : 'tests' }
UNCOV
82
PjStringTest >> testSplitOn [
×
UNCOV
83

×
UNCOV
84
        self assertEquivalent: [
×
UNCOV
85
                ('a.b.c' splitOn: '.') asArray ]
×
UNCOV
86
]
×
87

88
{ #category : 'tests' }
89
PjStringTest >> testStringHasOrInheritProperty [
1✔
90

1✔
91
        | ivName |
1✔
92
        ivName := #someIv.
1✔
93
        self denyBlock: [ 'hello!' hasOrInheritsProperty: ivName ].
1✔
94
        self denyBlock: [
1✔
95
                | jsString |
1✔
96
                jsString := 'wonderful'.
1✔
97
                jsString js_at: ivName put: 42.
1✔
98
                jsString hasOrInheritsProperty: ivName ]
1✔
99
]
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