Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
uwdkn
mjtest
Commits
4c8ebdac
Commit
4c8ebdac
authored
Nov 13, 2016
by
Johannes Bechberger
Committed by
GitHub
Nov 13, 2016
Browse files
Merge pull request #9 from mj3-16/fix-ast
Changed the ast flag to --print-ast and properly save pretty-printed input files
parents
11983076
eaae56f4
Changes
3
Show whitespace changes
Inline
Side-by-side
mjtest/environment.py
View file @
4c8ebdac
...
...
@@ -106,7 +106,7 @@ class Environment:
mode_flag
=
{
TestMode
.
lexer
:
"--lextest"
,
TestMode
.
syntax
:
"--parsetest"
,
TestMode
.
ast
:
"--pr
etty-prin
t"
TestMode
.
ast
:
"--pr
int-as
t"
}[
mode
]
cmd
=
[
self
.
mj_run_cmd
,
mode_flag
]
+
list
(
args
)
return
execute
(
cmd
,
timeout
=
self
.
timeout
)
...
...
mjtest/test/ast_tests.py
View file @
4c8ebdac
...
...
@@ -85,8 +85,8 @@ class ASTPrettyPrintTest(BasicSyntaxTest):
def
_pretty_print
(
self
,
input_file
:
str
,
output_file
:
str
)
->
Tuple
[
int
,
str
,
str
]:
out
,
err
,
rtcode
=
self
.
env
.
run_mj_command
(
TestMode
.
ast
,
input_file
)
with
open
(
output_file
,
"w"
)
as
f
:
print
(
out
,
file
=
f
)
with
open
(
output_file
,
"w
b
"
)
as
f
:
f
.
write
(
out
)
return
rtcode
,
out
.
decode
(),
err
.
decode
()
TestCase
.
TEST_CASE_CLASSES
[
"ast"
].
append
(
ASTPrettyPrintTest
)
mjtest/test/tests.py
View file @
4c8ebdac
...
...
@@ -281,7 +281,7 @@ class BasicTestResult(TestResult):
incorrect_msg
:
str
=
"incorrect return code"
):
super
().
__init__
(
test_case
,
error_code
)
self
.
_incorrect_msg
=
incorrect_msg
self
.
_contains_error_str
=
"error"
in
error_output
self
.
_contains_error_str
=
error_output
is
not
None
and
"error"
in
error_output
self
.
error_output
=
error_output
self
.
output
=
output
self
.
other_texts
=
[]
# type: List[Tuple[str, str, bool]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment