|
6 | 6 | import org.jetbrains.annotations.Contract; |
7 | 7 | import org.jetbrains.annotations.NotNull; |
8 | 8 | import org.jetbrains.annotations.Nullable; |
| 9 | +import org.junit.jupiter.api.Disabled; |
9 | 10 | import org.junit.jupiter.params.ParameterizedTest; |
10 | 11 | import org.junit.jupiter.params.provider.ValueSource; |
11 | 12 |
|
@@ -36,7 +37,8 @@ void assertInfixParsesTo_inner(String src, int level, MathSymbol expected) { |
36 | 37 | // Expects it to be full parse |
37 | 38 | Parser p = new Parser(src); |
38 | 39 | MathSymbol actual = assertDoesNotThrow(() -> p.parseInfixPrecedenceLevel(level)); |
39 | | - assertEquals(src.substring(0, p.idx), src, "Didn't fully parse the string"); // = isEof() but better msg |
| 40 | + assertEquals('"' + src + '"', '"' + src.substring(0, p.idx) + '"', |
| 41 | + "Didn't fully parse the string"); // = isEof() but better msg |
40 | 42 | assertTrue(p.isEof()); |
41 | 43 | assertEquals(expected, actual); |
42 | 44 | } |
@@ -146,6 +148,21 @@ void parse_pow(boolean disableCache) { |
146 | 148 | } |
147 | 149 | } |
148 | 150 |
|
| 151 | + |
| 152 | + @Disabled("[SKIP] Failing, will fix in a later PR") |
| 153 | + @ParameterizedTest |
| 154 | + @ValueSource(booleans = {true, false}) |
| 155 | + void parensWhitespaceBug(boolean disableCache) { |
| 156 | + try(var ignored = setNocacheAttr(disableCache)) { |
| 157 | + // These 3 are fine |
| 158 | + assertInfixParsesTo("( 1.2 )", MUL_PREC, new BasicDoubleSymbol(1.2)); |
| 159 | + assertParsesTo("( 1.2 )", new BasicDoubleSymbol(1.2)); |
| 160 | + assertParsesTo(" 1.2 ", new BasicDoubleSymbol(1.2)); |
| 161 | + // This is not - could be a bug in the future |
| 162 | + assertInfixParsesTo(" 1.2 ", 0, new BasicDoubleSymbol(1.2)); |
| 163 | + } |
| 164 | + } |
| 165 | + |
149 | 166 | protected WithNocache setNocacheAttr(boolean disableCache) { |
150 | 167 | return new WithNocache(this, disableCache); |
151 | 168 | } |
|
0 commit comments