Skip to content

Commit d9cd370

Browse files
committed
new string method testing
1 parent cffbcb1 commit d9cd370

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const helper = require('../helper.js');
2+
3+
const tests = [
4+
helper.createTest(
5+
'String.stripStart and String.stripEnd methods',
6+
`
7+
string text = "hello world"
8+
log text.stripStart("hello ")
9+
log text.stripEnd(" world")
10+
log text.stripStart("wow")
11+
log text.stripEnd("wow")
12+
log text.stripStart("")
13+
log text.stripEnd("")
14+
`,
15+
{ expect: ['world', 'hello', 'hello world', 'hello world', 'hello world', 'hello world'] }
16+
),
17+
18+
helper.createTest(
19+
'String.padStart and String.padEnd methods',
20+
`
21+
string text = "hello"
22+
log text.padStart("!", 10)
23+
log text.padEnd("!", 10)
24+
log text.padStart("!", 3)
25+
log text.padEnd("!", 3)
26+
`,
27+
{ expect: ['!!!!!hello', 'hello!!!!!', 'hello', 'hello'] }
28+
),
29+
30+
helper.createTest(
31+
'String.count method',
32+
`
33+
string text = "hello world"
34+
log text.count("hello")
35+
log text.count("world")
36+
log text.count("o")
37+
log text.count("")
38+
`,
39+
{ expect: [1, 1, 2, 0] }
40+
),
41+
42+
];
43+
44+
module.exports = { tests };

0 commit comments

Comments
 (0)