-
Notifications
You must be signed in to change notification settings - Fork 162
Expand file tree
/
Copy pathstring_test.jsonnet
More file actions
33 lines (31 loc) · 937 Bytes
/
string_test.jsonnet
File metadata and controls
33 lines (31 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local string = import '../string.libsonnet';
local test = import 'github.com/jsonnet-libs/testonnet/main.libsonnet';
test.new(std.thisFile)
+ test.case.new(
name='strReplaceMulti',
test=test.expect.eq(
actual=string.strReplaceMulti('hello world', [['hello', 'goodbye'], ['world', 'universe']]),
expected='goodbye universe',
)
)
+ test.case.new(
name='strReplaceMulti - chained',
test=test.expect.eq(
actual=string.strReplaceMulti('hello world', [['hello', 'goodbye'], ['goodbye', 'hi again']]),
expected='hi again world',
)
)
+ test.case.new(
name='strReplaceMulti - not found',
test=test.expect.eq(
actual=string.strReplaceMulti('hello world', [['first', 'second'], ['third', 'fourth']]),
expected='hello world',
)
)
+ test.case.new(
name='strReplaceMulti - empty replacements',
test=test.expect.eq(
actual=string.strReplaceMulti('hello world', []),
expected='hello world',
)
)