diff options
Diffstat (limited to 'ql/test/parsing')
23 files changed, 136 insertions, 0 deletions
diff --git a/ql/test/parsing/__pycache__/test_parsing.cpython-35.pyc b/ql/test/parsing/__pycache__/test_parsing.cpython-35.pyc Binary files differnew file mode 100644 index 0000000..4e89c3e --- /dev/null +++ b/ql/test/parsing/__pycache__/test_parsing.cpython-35.pyc diff --git a/ql/test/parsing/invalid/test001.ql b/ql/test/parsing/invalid/test001.ql new file mode 100644 index 0000000..fab17ac --- /dev/null +++ b/ql/test/parsing/invalid/test001.ql @@ -0,0 +1 @@ +// Empty file diff --git a/ql/test/parsing/invalid/test002.ql b/ql/test/parsing/invalid/test002.ql new file mode 100644 index 0000000..d84f901 --- /dev/null +++ b/ql/test/parsing/invalid/test002.ql @@ -0,0 +1,3 @@ +// Empty form without label +form { +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test003.ql b/ql/test/parsing/invalid/test003.ql new file mode 100644 index 0000000..57975a1 --- /dev/null +++ b/ql/test/parsing/invalid/test003.ql @@ -0,0 +1,3 @@ +// Empty form +form testForm { +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test004.ql b/ql/test/parsing/invalid/test004.ql new file mode 100644 index 0000000..6f2fb9f --- /dev/null +++ b/ql/test/parsing/invalid/test004.ql @@ -0,0 +1,5 @@ +// Form without label +form { + "Question?" + var : boolean +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test005.ql b/ql/test/parsing/invalid/test005.ql new file mode 100644 index 0000000..5b67d6e --- /dev/null +++ b/ql/test/parsing/invalid/test005.ql @@ -0,0 +1,5 @@ +// Question label without quotation marks +form testForm { + question + var : cows +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test006.ql b/ql/test/parsing/invalid/test006.ql new file mode 100644 index 0000000..b902dc9 --- /dev/null +++ b/ql/test/parsing/invalid/test006.ql @@ -0,0 +1,5 @@ +// Question with invalid type +form testForm { + "Question?" + var : cows +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test007.ql b/ql/test/parsing/invalid/test007.ql new file mode 100644 index 0000000..e16685e --- /dev/null +++ b/ql/test/parsing/invalid/test007.ql @@ -0,0 +1,5 @@ +// Question identifier with quotation marks +form testForm { + "Question?" + "var" : boolean +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test018.ql b/ql/test/parsing/invalid/test018.ql new file mode 100644 index 0000000..80deece --- /dev/null +++ b/ql/test/parsing/invalid/test018.ql @@ -0,0 +1,7 @@ +// Empty if conditional +form testForm { + if () { + "Question?" + id : boolean + } +}
\ No newline at end of file diff --git a/ql/test/parsing/invalid/test019.ql b/ql/test/parsing/invalid/test019.ql new file mode 100644 index 0000000..1bde8f1 --- /dev/null +++ b/ql/test/parsing/invalid/test019.ql @@ -0,0 +1,5 @@ +// Empty if block +form label { + if (1 == 2) { + } +}
\ No newline at end of file diff --git a/ql/test/parsing/test_parsing.py b/ql/test/parsing/test_parsing.py new file mode 100644 index 0000000..86900f9 --- /dev/null +++ b/ql/test/parsing/test_parsing.py @@ -0,0 +1,16 @@ +from ql.test.test import Test + + +class TestParsing(Test): + def __init__(self, directory, lexer, parser): + super(TestParsing, self).__init__('parsing', directory) + self.__lexer = lexer + self.__parser = parser + + def test_file(self, file): + self.__parser.parse(file, self.__lexer.lexer) + + if self.__parser.errors: + return False + + return True diff --git a/ql/test/parsing/valid/test001.ql b/ql/test/parsing/valid/test001.ql new file mode 100644 index 0000000..aecb488 --- /dev/null +++ b/ql/test/parsing/valid/test001.ql @@ -0,0 +1,5 @@ +// Form with question type boolean +form testForm { + "Question?" + var: boolean +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test002.ql b/ql/test/parsing/valid/test002.ql new file mode 100644 index 0000000..89402fa --- /dev/null +++ b/ql/test/parsing/valid/test002.ql @@ -0,0 +1,5 @@ +// Form with question of type date +form testForm { + "Question?" + var: date +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test003.ql b/ql/test/parsing/valid/test003.ql new file mode 100644 index 0000000..8f8f448 --- /dev/null +++ b/ql/test/parsing/valid/test003.ql @@ -0,0 +1,5 @@ +// Form with question of type decimal +form testForm { + "Question?" + var: decimal +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test004.ql b/ql/test/parsing/valid/test004.ql new file mode 100644 index 0000000..7d4b77b --- /dev/null +++ b/ql/test/parsing/valid/test004.ql @@ -0,0 +1,5 @@ +// Form with question of type integer +form testForm { + "Question?" + var: integer +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test005.ql b/ql/test/parsing/valid/test005.ql new file mode 100644 index 0000000..eafc6c1 --- /dev/null +++ b/ql/test/parsing/valid/test005.ql @@ -0,0 +1,5 @@ +// Form with question of type money +form testForm { + "Question?" + var: money +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test006.ql b/ql/test/parsing/valid/test006.ql new file mode 100644 index 0000000..16efa4d --- /dev/null +++ b/ql/test/parsing/valid/test006.ql @@ -0,0 +1,5 @@ +// Form with question of type string +form testForm { + "Question?" + var: string +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test007.ql b/ql/test/parsing/valid/test007.ql new file mode 100644 index 0000000..dd2b47a --- /dev/null +++ b/ql/test/parsing/valid/test007.ql @@ -0,0 +1,8 @@ +// Form with two questions with the same identifier +form testForm { + "Question?" + var: boolean + + "Question?" + var: boolean +} diff --git a/ql/test/parsing/valid/test008.ql b/ql/test/parsing/valid/test008.ql new file mode 100644 index 0000000..20cb866 --- /dev/null +++ b/ql/test/parsing/valid/test008.ql @@ -0,0 +1,8 @@ +// Form with two questions with different identifiers +form testForm { + "Question?" + var1: boolean + + "Question?" + var2: boolean +} diff --git a/ql/test/parsing/valid/test009.ql b/ql/test/parsing/valid/test009.ql new file mode 100644 index 0000000..a4edfa1 --- /dev/null +++ b/ql/test/parsing/valid/test009.ql @@ -0,0 +1,20 @@ +// Form with questions of all supported types +form testForm { + "Question?" + var1: boolean + + "Question?" + var2: date + + "Question?" + var3: decimal + + "Question?" + var4: integer + + "Question?" + var5: money + + "Question?" + var6: string +} diff --git a/ql/test/parsing/valid/test010.ql b/ql/test/parsing/valid/test010.ql new file mode 100644 index 0000000..c1985f8 --- /dev/null +++ b/ql/test/parsing/valid/test010.ql @@ -0,0 +1,5 @@ +// Form with computed question +form testForm { + "Question?" + var: boolean = True +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test011.ql b/ql/test/parsing/valid/test011.ql new file mode 100644 index 0000000..a59cae6 --- /dev/null +++ b/ql/test/parsing/valid/test011.ql @@ -0,0 +1,5 @@ +// Form with computed question +form testForm { + "Question?" + var: boolean = False +}
\ No newline at end of file diff --git a/ql/test/parsing/valid/test012.ql b/ql/test/parsing/valid/test012.ql new file mode 100644 index 0000000..d745fba --- /dev/null +++ b/ql/test/parsing/valid/test012.ql @@ -0,0 +1,5 @@ +// Form with computed question +form testForm { + "Question?" + var: boolean = "ADSADsad" +}
\ No newline at end of file |