| 1 | const ca = r'x\n' |
| 2 | |
| 3 | const cb = 'x\n' |
| 4 | |
| 5 | const cc = ca + cb |
| 6 | |
| 7 | const cd = cc + cc |
| 8 | |
| 9 | const ce = cd + cd |
| 10 | |
| 11 | fn test_raw_string_backslash() { |
| 12 | assert r'\' == r'\' |
| 13 | } |
| 14 | |
| 15 | fn test_raw_string_not_escaped_by_transformer() { |
| 16 | assert r'a\nb' + r'a\nb' == r'a\nba\nb' |
| 17 | assert 'a\nb' + r'a\nb' == 'a\nba\\nb' |
| 18 | } |
| 19 | |
| 20 | fn test_raw_string_backslash_u() { |
| 21 | assert r'\u0000004B' == r'\u0000004B' |
| 22 | println(r'\u0000004B') |
| 23 | } |
| 24 | |
| 25 | // this test will cause test failure (see #12604) |
| 26 | // fn test_many_pluses() { |
| 27 | // a := r'x\n' |
| 28 | // assert a == ca |
| 29 | // b := 'x\n' |
| 30 | // assert b == cb |
| 31 | // c := a + b |
| 32 | // assert c == cc // this fails |
| 33 | // d := c + c |
| 34 | // assert d == cd |
| 35 | // e := d + d |
| 36 | // assert e == ce |
| 37 | // println(e) |
| 38 | // result := r'x\nx |
| 39 | // x\nx |
| 40 | // x\nx |
| 41 | // x\nx |
| 42 | // ' |
| 43 | // assert e == result |
| 44 | // } |
| 45 | |