Skip to content

Commit

Permalink
feat(objectionary#3744): fix most of the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jan 15, 2025
1 parent 54a7650 commit d0c4269
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 23 deletions.
4 changes: 2 additions & 2 deletions eo-parser/src/main/java/org/eolang/parser/EoParserErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public void syntaxError(
final String detailed;
final String[] names = parser.getRuleNames();
if (names[EoParser.RULE_program].equals(rule)) {
detailed = "Unexpected part of the program";
detailed = "We expected the program to end here but encountered something unexpected";
} else if (names[EoParser.RULE_objects].equals(rule)) {
detailed = "We expected a list of objects here, but found something else";
detailed = "We expected a list of objects here but encountered something unexpected";
} else {
detailed = msg;
}
Expand Down
2 changes: 1 addition & 1 deletion eo-parser/src/main/java/org/eolang/parser/Lines.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ String line(final int number) {
.map(UncheckedText::new)
.map(UncheckedText::asString);
}
return result.orElse("EOF");
return result.orElse("");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
# SOFTWARE.
---
line: 2
message: |-
message: |+
[2:4] error: 'Invalid objects declaration that may be used inside abstract object'
y:^
^
[3:-1] error: 'Unexpected part of the program'
EOF
^^^
input: |
[3:-1] error: 'We expected the program to end here but encountered something unexpected'
input: |-
x
y:^
y:^
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ message: |-
[5:12] error: 'Invalid objects declaration that may be used inside abstract object'
sprintwf
[4:-1] error: 'Unexpected part of the program'
[4:-1] error: 'We expected the program to end here but encountered something unexpected'
# a comment here is prohibited
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ line: 4
# The error message should be more informative and should highlight the exact location
# of the error.
message: |+
[4:0] error: 'Unexpected part of the program'
[4:0] error: 'We expected the program to end here but encountered something unexpected'
input: |
# No comments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
---
line: 3
message: |-
[3:0] error: 'We expected a list of objects here, but found something else'
[3:0] error: 'We expected a list of objects here but encountered something unexpected'
+meta other
^^^^^^^^^^
input: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
---
line: 4
message: |-
[4:-1] error: 'Invalid program declaration'
[4:-1] error: 'We expected the program to end here but encountered something unexpected'
[] > inner
^^^^^^^^^^^^
input: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
# SOFTWARE.
---
line: 3
message: |-
[3:-1] error: 'Invalid program declaration'
EOF
^^^
message: |+
[3:-1] error: 'We expected the program to end here but encountered something unexpected'
input: |
1.add 1 > x
(1.add 1) > y
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ line: 3
# The error message should be more informative and should point to the exact
# place in the input where the error occurred. Moreover it should be clear
# what to do to fix the error. 'simple-application-named.yaml' has the same issue.
message: |-
[3:-1] error: 'Invalid program declaration'
EOF
^^^
message: |+
[3:-1] error: 'We expected the program to end here but encountered something unexpected'
input: |
1.add 1 > x
(1.add 1)
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ message: >-
[5:2] error: 'Invalid object declaration'
*
^
[5:2] error: 'Invalid objects declaration that may be used inside abstract object'
*
^
[5:-1] error: 'We expected the program to end here but encountered something unexpected'
*
^^^^
input: |
# This is a code snippet from the following issue:
# https://github.com/objectionary/eo/issues/3332
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
---
line: 2
message: |-
[2:0] error: 'Invalid program declaration'
[2:0] error: 'We expected the program to end here but encountered something unexpected'
.z
^
input: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
---
line: 2
message: |-
[2:0] error: 'Invalid program declaration'
[2:0] error: 'We expected the program to end here but encountered something unexpected'
.z
^
input: |
Expand Down

0 comments on commit d0c4269

Please sign in to comment.