-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
362 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/functional/registration/projects/flow_dsl/tests/models/MODEL_WITH_IMPORT_ERROR.eflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "data_structures_including_error.edata" // <--- types must be lowercase | ||
#include "types.etype" | ||
|
||
algo A1 : Point -> City | ||
algo A2 : City -> Population | ||
connect A1 -> A2 |
6 changes: 6 additions & 0 deletions
6
...nctional/registration/projects/flow_dsl/tests/models/MODEL_WITH_IMPORT_SYNTAX_ERROR.eflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "data_structures.edata" | ||
#include "types_with_syntax_error.etype" | ||
|
||
algo A1 : Point -> City | ||
algo A2 : City -> Population | ||
connect A1 -> A2 |
6 changes: 6 additions & 0 deletions
6
tests/functional/registration/projects/flow_dsl/tests/models/MODEL_WITH_SYNTAX_ERROR.eflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
UNEXPECTED_#include "data_structures_including_error.edata" | ||
#include "types.etype" | ||
|
||
algo A1 : Point -> City | ||
algo A2 : City -> Population | ||
connect A1 -> A // <--- Unknown object "A" of class "Algo" |
6 changes: 6 additions & 0 deletions
6
tests/functional/registration/projects/flow_dsl/tests/models/MODEL_WITH_TYPE_ERROR.eflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "data_structures_including_error.edata" | ||
#include "types.etype" | ||
|
||
algo A1 : Point -> City | ||
algo A2 : City -> Population | ||
connect A1 -> A // <--- Unknown object "A" of class "Algo" |
2 changes: 2 additions & 0 deletions
2
tests/functional/registration/projects/flow_dsl/tests/models/types_with_syntax_error.etype
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
UNEXPECTED_type Int // Syntax error | ||
type string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
tests/functional/registration/projects/flow_dsl/tests/test_issue196.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
from textx import metamodel_for_language | ||
from textx.exceptions import TextXError | ||
import os.path | ||
import pytest | ||
|
||
|
||
current_dir = os.path.dirname(__file__) | ||
|
||
|
||
def test_issue196_errors_in_scope_provider_and_obj_processor(): | ||
mmF = metamodel_for_language('flow-dsl') | ||
|
||
# print("-----------------------------------1---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
cached_model_count = len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
with pytest.raises(TextXError, | ||
match=r'.*types must be lowercase.*'): | ||
mmF.model_from_file(os.path.join(current_dir, | ||
'models', | ||
'MODEL_WITH_IMPORT_ERROR.eflow')) | ||
|
||
# print("-----------------------------------2---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
# error while reading, no file cached (cached_model_count unchanged)! | ||
assert cached_model_count == len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
with pytest.raises(TextXError, | ||
match=r'.*Unknown object "A" of class "Algo".*'): | ||
print("loading MODEL_WITH_TYPE_ERROR") | ||
mmF.model_from_file(os.path.join(current_dir, | ||
'models', | ||
'MODEL_WITH_TYPE_ERROR.eflow')) | ||
|
||
# print("-----------------------------------3---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
# error while reading, no file cached! (cached_model_count unchanged)! | ||
assert cached_model_count == len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
with pytest.raises(TextXError, | ||
match=r'.*types must be lowercase.*'): | ||
mmF.model_from_file(os.path.join(current_dir, | ||
'models', | ||
'MODEL_WITH_IMPORT_ERROR.eflow')) | ||
|
||
# error while reading, no file cached! (cached_model_count unchanged)! | ||
assert cached_model_count == len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
|
||
def test_issue196_syntax_error_1(): | ||
mmF = metamodel_for_language('flow-dsl') | ||
|
||
# print("-----------------------------------1---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
cached_model_count = len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
with pytest.raises(TextXError, | ||
match=r'.*error: Expected.*'): | ||
mmF.model_from_file( | ||
os.path.join(current_dir, | ||
'models', | ||
'MODEL_WITH_IMPORT_SYNTAX_ERROR.eflow')) | ||
|
||
# print("-----------------------------------2---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
# error while reading, no file cached! | ||
assert cached_model_count == len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
|
||
def test_issue196_syntax_error_2(): | ||
mmF = metamodel_for_language('flow-dsl') | ||
|
||
# print("-----------------------------------1---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
cached_model_count = len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) | ||
|
||
with pytest.raises(TextXError, | ||
match=r'.*error: Expected.*'): | ||
mmF.model_from_file(os.path.join(current_dir, | ||
'models', | ||
'MODEL_WITH_SYNTAX_ERROR.eflow')) | ||
|
||
# print("-----------------------------------2---") | ||
# print(metamodel_for_language('flow-dsl'). | ||
# _tx_model_repository.all_models.filename_to_model.keys()) | ||
|
||
# error while reading, no file cached! (cached_model_count unchanged)! | ||
assert cached_model_count == len( | ||
metamodel_for_language('flow-dsl'). | ||
_tx_model_repository.all_models.filename_to_model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.