1 | @import "restyle";
|
2 |
|
3 | $tests: (
|
4 | '{a}, {b}, {c}': (
|
5 | (
|
6 | data: (a: 1, b: 2, c: 3),
|
7 | expected: '1, 2, 3'
|
8 | ),
|
9 | (
|
10 | data: (a: 1),
|
11 | expected: '1, {b}, {c}'
|
12 | ),
|
13 | (
|
14 | data: null,
|
15 | expected: '{a}, {b}, {c}'
|
16 | )
|
17 | ),
|
18 | '': (
|
19 | (
|
20 | data: (a: 1),
|
21 | expected: ''
|
22 | ),
|
23 | (
|
24 | data: null,
|
25 | expected: ''
|
26 | )
|
27 | )
|
28 | );
|
29 |
|
30 | @each $str, $test in $tests {
|
31 | @each $case in $test {
|
32 | $data: map-get($case, data);
|
33 | $expected: map-get($case, expected);
|
34 |
|
35 | $actual: -restyle--str-substitute-js($str, $data);
|
36 |
|
37 | @if ($actual != $expected) {
|
38 | @error "-restyle--str-substitute-js('#{$str}', #{inspect($data)}) should be `#{$expected}` but got #{$actual}";
|
39 | }
|
40 | }
|
41 | }
|