Skip to content

Commit

Permalink
#2230 typo is not detected
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 11, 2023
1 parent bb03b4e commit 03620bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eo-parser/src/test/java/org/eolang/parser/SyntaxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -226,13 +227,18 @@ void storesAsBytes(final String code) throws IOException {
void checksTypoPacks(final String yml) throws IOException, NumberFormatException {
final Yaml yaml = new Yaml();
final Map<String, Object> map = yaml.load(yml);
Assumptions.assumeTrue(map.get("skip") == null);
final ByteArrayOutputStream xmir = new ByteArrayOutputStream();
new Syntax(
"typo",
new InputOf(String.format("%s\n", map.get("eo"))),
new OutputTo(xmir)
).parse();
final XML xml = new XMLDocument(xmir.toByteArray());
MatcherAssert.assertThat(
XhtmlMatchers.xhtml(xml.toString()),
XhtmlMatchers.hasXPaths("/program/errors/error/@line")
);
MatcherAssert.assertThat(
xml.toString(),
Integer.parseInt(xml.xpath("/program/errors/error[1]/@line").get(0)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @todo #2230:30min The test is skipped because it doesn't work.
# The syntax below is not supported, but it passes the test and
# no typos are detected. We should fix it. Most probably EOL-s
# are not detected at the end of objects correctly.
skip: true
line: 1
eo: |
[] > a [] > b [] > c [] > d hello world

1 comment on commit 03620bf

@0pdd
Copy link

@0pdd 0pdd commented on 03620bf Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2230-f92ad967 discovered in eo-parser/src/test/resources/org/eolang/parser/typos/broken-head.yaml) and submitted as #2231. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.