forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplace.feature
72 lines (44 loc) · 1.42 KB
/
replace.feature
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Feature: replace keyword
Scenario: one-line default placeholder
* def text = 'hello <foo> world'
* replace text.foo = 'bar'
* match text == 'hello bar world'
Scenario: one-line non-default placeholder 1
* def text = 'hello ${foo} world'
* replace text.${foo} = 'bar'
* match text == 'hello bar world'
Scenario: one-line non-default placeholder 2
* def text = 'hello @@foo@@ world'
* replace text.@@foo@@ = 'bar'
* match text == 'hello bar world'
Scenario: table default placeholder
* def text = 'hello <one> world <two> bye'
* replace text
| token | value |
| one | 'cruel' |
| two | 'good' |
* match text == 'hello cruel world good bye'
Scenario: table non-default placeholder
* def text = 'hello ${one} world @@two@@ bye'
* replace text
| token | value |
| ${one} | 'cruel' |
| @@two@@ | 'good' |
* match text == 'hello cruel world good bye'
Scenario: table with expression evaluation
* def text = 'hello <one> world <two> bye'
* def first = 'cruel'
* def second = 'good'
* replace text
| token | value |
| one | first |
| two | second |
* match text == 'hello cruel world good bye'
Scenario: table with complex expression evaluation
* def text = 'hello <one> world <two> bye'
* def json = { first: 'cruel', second: 'good' }
* replace text
| token | value |
| one | json.first |
| two | json.second |
* match text == 'hello cruel world good bye'