Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IPDSnelting
mjtest
Commits
23eee370
Commit
23eee370
authored
Nov 14, 2016
by
Johannes Bechberger
Browse files
Add semantic test runner
parent
713da1c4
Changes
3
Show whitespace changes
Inline
Side-by-side
mjtest/environment.py
View file @
23eee370
...
...
@@ -111,7 +111,8 @@ class Environment:
mode_flag
=
{
TestMode
.
lexer
:
"--lextest"
,
TestMode
.
syntax
:
"--parsetest"
,
TestMode
.
ast
:
"--print-ast"
TestMode
.
ast
:
"--print-ast"
,
TestMode
.
semantic
:
"--check"
}[
mode
]
cmd
=
[
self
.
mj_run_cmd
,
mode_flag
]
+
list
(
args
)
return
execute
(
cmd
,
timeout
=
self
.
timeout
)
...
...
mjtest/test/semantic_tests.py
0 → 100644
View file @
23eee370
from
mjtest.environment
import
TestMode
from
mjtest.test.syntax_tests
import
BasicSyntaxTest
from
mjtest.test.tests
import
TestCase
class
BasicSemanticTest
(
BasicSyntaxTest
):
FILE_ENDINGS
=
[
".invalid.mj"
,
".valid.mj"
,
".mj"
,
".invalid.java"
,
".java"
]
MODE
=
TestMode
.
semantic
TestCase
.
TEST_CASE_CLASSES
[
TestMode
.
semantic
].
append
(
BasicSemanticTest
)
\ No newline at end of file
mjtest/test/tests.py
View file @
23eee370
...
...
@@ -127,12 +127,15 @@ class TestSuite:
failed
=
0
count
=
0
for
test_case
in
self
.
test_cases
[
mode
]:
try
:
ret
=
self
.
_run_test_case
(
test_case
)
if
ret
is
False
or
not
ret
.
is_correct
():
failed
+=
1
else
:
self
.
_add_correct_test_case
(
test_case
)
count
+=
1
except
KeyboardInterrupt
:
return
RunResult
(
count
,
failed
)
return
RunResult
(
count
,
failed
)
def
_func
(
self
,
test_case
:
'TestCase'
):
...
...
@@ -425,3 +428,4 @@ TestCase.TEST_CASE_CLASSES[TestMode.lexer].append(LexerDiffTest)
import
mjtest.test.syntax_tests
import
mjtest.test.ast_tests
import
mjtest.test.semantic_tests
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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