Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Fixed redefined tests and added redefined test detection #28

Merged
merged 3 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions ifj2017/test/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,20 @@ def _load_compact_tests(self, section_dir):
extensions = tuple(data.get('extensions', ()))
try:
for i, test_case in enumerate(data.get('tests', ())):
name = test_case.get('name') or '{:03}'.format(i + 1)
code = test_case.get('code') or self._load_test_file(section_dir, name, 'code')
name = test_case.get('name')
code = test_case.get('code')

if name and code:
TestLogger.log_warning(
"Redefined test {} in file {}.".format(name, path.join(section_dir, 'tests.json'))
)
Copy link
Owner

Choose a reason for hiding this comment

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

Asi bych v tomto případě přeskakoval načtení tohoto konkrétního testu, protože pak se jeden zakrývá a není to úplně transparentní.


if not name:
name = '{:03}'.format(i + 1)

if not code:
code = self._load_test_file(section_dir, name, 'code')

cases.append(
TestInfo(
name,
Expand Down
5 changes: 0 additions & 5 deletions ifj2017/tests/01_basic/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,27 @@
"stdout": "? Martin Kobelka napsal tento test"
},
{
"name": "13",
"info": "Multi line string",
"stdout": "ahoj\nsvete",
"code": "scope \n print !\"ahoj\\nsvete\"; \nend scope"
},
{
"name": "14",
"info": "Simple integer print",
"stdout": " 42",
"code": "scope \n print 42; \nend scope"
},
{
"name": "15",
"info": "Simple double print",
"stdout": " 5876.78",
"code": "scope \n print 5876.78; \nend scope"
},
{
"name": "16",
"info": "Simple input and print",
"stdin": "42",
"stdout": "? 42",
"code": "scope \n dim a as integer \n input a \n print a; \nend scope"
},
{
"name": "17",
"info": "Add two inputs",
"stdin": "42\n24",
"stdout": "? ? 66",
Expand Down
2 changes: 0 additions & 2 deletions ifj2017/tests/02_functions/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
"compiler_exit_code": 4
},
{
"name": "01",
"info": "Asc value",
"stdout": " 104",
"code": "scope \n print asc(!\"ahoj\", 2); \n end scope"
},
{
"name": "02",
"info": "Chr function",
"stdout": "a",
"code": "scope \n print chr(97); \n end scope"
Expand Down