diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index 0848c255..e7ce6900 100644 --- a/test/JPP_TestUsecases.csv +++ b/test/JPP_TestUsecases.csv @@ -50,8 +50,9 @@ JPP_0506|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file with composite strings contain JPP_0507|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several string concatenations in separate lines (1) JPP_0508|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several string concatenations in separate lines (2) JPP_0509|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several parameter assignments in separate lines (different syntax) +JPP_0510|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several parameter assignments in separate lines (extended string concatenation) JPP_0550|COMPOSITE_EXPRESSIONS|BADCASE|JSON file with composite data structure (nested lists and dictionaries / some key names with dots inside) -JPP_0900|COMMON_SYNTAX_VIOLATIONS|GOODCASE|JSON file with syntax error, that is commented out +JPP_0600|CODE_COMMENTS|GOODCASE|JSON file with several combinations of code comments JPP_0950|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (1) JPP_0951|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (2) JPP_0952|COMMON_SYNTAX_VIOLATIONS|BADCASE|JSON file with syntax error (3) diff --git a/test/JPP_TestUsecases.html b/test/JPP_TestUsecases.html index b49b032d..d092480f 100644 --- a/test/JPP_TestUsecases.html +++ b/test/JPP_TestUsecases.html @@ -1707,6 +1707,39 @@ 51 + + + +JPP_0510 + + + + +COMPOSITE_EXPRESSIONS + + + + +GOODCASE + + + + +JSON file containing several parameter assignments in separate lines (extended string concatenation)
+Expected: JsonPreprocessor returns expected value + + +
+ + + + + + + +52 + + @@ -1738,18 +1771,18 @@ -52 +53 -JPP_0900 +JPP_0600 -COMMON_SYNTAX_VIOLATIONS +CODE_COMMENTS @@ -1759,7 +1792,7 @@ -JSON file with syntax error, that is commented out
+JSON file with several combinations of code comments
Expected: JsonPreprocessor returns remaining content of JSON file (valid parameters) @@ -1771,7 +1804,7 @@ -53 +54 @@ -1804,7 +1837,7 @@ -54 +55 @@ -1837,7 +1870,7 @@ -55 +56 @@ -1870,7 +1903,7 @@ -56 +57 @@ -1903,7 +1936,7 @@ -57 +58 @@ -1936,7 +1969,7 @@ -58 +59 @@ -1969,7 +2002,7 @@ -59 +60 @@ -2002,7 +2035,7 @@ -60 +61 @@ -2035,7 +2068,7 @@ -61 +62 @@ -2068,7 +2101,7 @@ -62 +63 @@ -2102,7 +2135,7 @@
 

-
Generated: 10.10.2023 - 13:31:11
+
Generated: 18.10.2023 - 17:37:45
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index e8fee5b9..7c806efd 100644 --- a/test/JPP_TestUsecases.rst +++ b/test/JPP_TestUsecases.rst @@ -561,6 +561,16 @@ Test Use Cases ---- +* **Test JPP_0510** + + [COMPOSITE_EXPRESSIONS / GOODCASE] + + **JSON file containing several parameter assignments in separate lines (extended string concatenation)** + + Expected: JsonPreprocessor returns expected value + +---- + * **Test JPP_0550** [COMPOSITE_EXPRESSIONS / BADCASE] @@ -573,11 +583,11 @@ Test Use Cases ---- -* **Test JPP_0900** +* **Test JPP_0600** - [COMMON_SYNTAX_VIOLATIONS / GOODCASE] + [CODE_COMMENTS / GOODCASE] - **JSON file with syntax error, that is commented out** + **JSON file with several combinations of code comments** Expected: JsonPreprocessor returns remaining content of JSON file (valid parameters) @@ -685,5 +695,5 @@ Test Use Cases ---- -Generated: 10.10.2023 - 13:31:11 +Generated: 18.10.2023 - 17:37:45 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 04b2fa9d..c1646d12 100644 --- a/test/JPP_TestUsecases.txt +++ b/test/JPP_TestUsecases.txt @@ -238,13 +238,17 @@ Test JPP_0509 / COMPOSITE_EXPRESSIONS / GOODCASE Description: JSON file containing several parameter assignments in separate lines (different syntax) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ +Test JPP_0510 / COMPOSITE_EXPRESSIONS / GOODCASE +Description: JSON file containing several parameter assignments in separate lines (extended string concatenation) +Expectation: JsonPreprocessor returns expected value +------------------------------------------------------------------------------------------------------------------------ Test JPP_0550 / COMPOSITE_EXPRESSIONS / BADCASE Description: JSON file with composite data structure (nested lists and dictionaries / some key names with dots inside) Expectation: No values are returned, and JsonPreprocessor throws an exception Hint.......: Dotdict notation (ambiguous in this case) ------------------------------------------------------------------------------------------------------------------------ -Test JPP_0900 / COMMON_SYNTAX_VIOLATIONS / GOODCASE -Description: JSON file with syntax error, that is commented out +Test JPP_0600 / CODE_COMMENTS / GOODCASE +Description: JSON file with several combinations of code comments Expectation: JsonPreprocessor returns remaining content of JSON file (valid parameters) ------------------------------------------------------------------------------------------------------------------------ Test JPP_0950 / COMMON_SYNTAX_VIOLATIONS / BADCASE @@ -288,5 +292,5 @@ Description: Relative path to JSON file Expectation: JsonPreprocessor resolves the relative path and returns values from JSON file Hint.......: Works with raw path to JSON file (path not normalized internally) ------------------------------------------------------------------------------------------------------------------------ -Generated: 10.10.2023 - 13:31:11 +Generated: 18.10.2023 - 17:37:45 diff --git a/test/component_test.py b/test/component_test.py index 9a09499c..6e285531 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,8 +22,8 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.17.0" -VERSION_DATE = "11.10.2023" +VERSION = "0.18.0" +VERSION_DATE = "18.10.2023" # # -------------------------------------------------------------------------------------------------------------- #TM*** diff --git a/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py b/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py index 9d8bf3bd..95f0ff5b 100644 --- a/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py +++ b/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py @@ -18,7 +18,7 @@ # # XC-CT/ECA3-Queckenstedt # -# 10.10.2023 - 13:31:11 +# 18.10.2023 - 17:37:45 # # -------------------------------------------------------------------------------------------------------------- @@ -93,4 +93,12 @@ def test_JPP_0508(self, Description): def test_JPP_0509(self, Description): nReturn = CExecute.Execute("JPP_0509") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: JsonPreprocessor returns expected value + @pytest.mark.parametrize( + "Description", ["JSON file containing several parameter assignments in separate lines (extended string concatenation)",] + ) + def test_JPP_0510(self, Description): + nReturn = CExecute.Execute("JPP_0510") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_09_COMMON_SYNTAX_VIOLATIONS_GOODCASE.py b/test/pytest/pytestfiles/test_09_CODE_COMMENTS_GOODCASE.py similarity index 84% rename from test/pytest/pytestfiles/test_09_COMMON_SYNTAX_VIOLATIONS_GOODCASE.py rename to test/pytest/pytestfiles/test_09_CODE_COMMENTS_GOODCASE.py index ac77dc18..4a314c92 100644 --- a/test/pytest/pytestfiles/test_09_COMMON_SYNTAX_VIOLATIONS_GOODCASE.py +++ b/test/pytest/pytestfiles/test_09_CODE_COMMENTS_GOODCASE.py @@ -14,11 +14,11 @@ # limitations under the License. # -------------------------------------------------------------------------------------------------------------- # -# test_09_COMMON_SYNTAX_VIOLATIONS_GOODCASE.py +# test_09_CODE_COMMENTS_GOODCASE.py # # XC-CT/ECA3-Queckenstedt # -# 10.10.2023 - 13:31:11 +# 18.10.2023 - 17:37:45 # # -------------------------------------------------------------------------------------------------------------- @@ -27,14 +27,14 @@ # -------------------------------------------------------------------------------------------------------------- -class Test_COMMON_SYNTAX_VIOLATIONS_GOODCASE: +class Test_CODE_COMMENTS_GOODCASE: # -------------------------------------------------------------------------------------------------------------- # Expected: JsonPreprocessor returns remaining content of JSON file (valid parameters) @pytest.mark.parametrize( - "Description", ["JSON file with syntax error, that is commented out",] + "Description", ["JSON file with several combinations of code comments",] ) - def test_JPP_0900(self, Description): - nReturn = CExecute.Execute("JPP_0900") + def test_JPP_0600(self, Description): + nReturn = CExecute.Execute("JPP_0600") assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index db57660c..c98cbb8a 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -# 11.10.2023 +# 18.10.2023 # # !!! Temporarily tests are deactivated by the following line commented out: # # # listofdictUsecases.append(dictUsecase) @@ -1970,6 +1970,25 @@ listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- +dictUsecase = {} +# can be combined with previous test cases after issue is solved +dictUsecase['TESTID'] = "JPP_0510" +dictUsecase['DESCRIPTION'] = "JSON file containing several parameter assignments in separate lines (extended string concatenation)" +dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" +dictUsecase['SECTION'] = "COMPOSITE_EXPRESSIONS" +dictUsecase['SUBSECTION'] = "GOODCASE" +dictUsecase['HINT'] = None +dictUsecase['COMMENT'] = None +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0510.jsonp" +dictUsecase['EXPECTEDEXCEPTION'] = None +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (1/1) > {params} [DICT] (1/1) > {global} [DICT] (4/1) > {teststring_1} [STR] : 'prefix.teststring_1.value.suffix_1.suffix_2.suffix_3' +[DICT] (1/1) > {params} [DICT] (1/1) > {global} [DICT] (4/2) > {teststring_2} [STR] : 'teststring_2.value.suffix_1' +[DICT] (1/1) > {params} [DICT] (1/1) > {global} [DICT] (4/3) > {teststring_3} [STR] : 'teststring_3.value.5' +[DICT] (1/1) > {params} [DICT] (1/1) > {global} [DICT] (4/4) > {testdict} [DICT] (1/1) > {key} [DICT] (1/1) > {teststring_4} [STR] : 'teststring_4.initial_value.suffix_1.suffix_2'""" +listofdictUsecases.append(dictUsecase) +del dictUsecase +# -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} dictUsecase['TESTID'] = "JPP_0550" @@ -1987,16 +2006,28 @@ # -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} -dictUsecase['TESTID'] = "JPP_0900" -dictUsecase['DESCRIPTION'] = "JSON file with syntax error, that is commented out" +dictUsecase['TESTID'] = "JPP_0600" +dictUsecase['DESCRIPTION'] = "JSON file with several combinations of code comments" dictUsecase['EXPECTATION'] = "JsonPreprocessor returns remaining content of JSON file (valid parameters)" -dictUsecase['SECTION'] = "COMMON_SYNTAX_VIOLATIONS" +dictUsecase['SECTION'] = "CODE_COMMENTS" dictUsecase['SUBSECTION'] = "GOODCASE" dictUsecase['HINT'] = None dictUsecase['COMMENT'] = None -dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0900.jsonp" +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0600.jsonp" dictUsecase['EXPECTEDEXCEPTION'] = None -dictUsecase['EXPECTEDRETURN'] = "[DICT] (1/1) > {param} [STR] : 'value'" +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (6/1) > {param1} [STR] : 'value1' +[DICT] (6/2) > {param2} [STR] : 'value2' +[DICT] (6/3) > {testdict1} [DICT] (3/1) > {A} [INT] : 1 +[DICT] (6/3) > {testdict1} [DICT] (3/2) > {B} [INT] : 2 +[DICT] (6/3) > {testdict1} [DICT] (3/3) > {C} [INT] : 3 +[DICT] (6/4) > {testdict2} [DICT] (2/1) > {A} [INT] : 1 +[DICT] (6/4) > {testdict2} [DICT] (2/2) > {C} [INT] : 3 +[DICT] (6/5) > {testdict3} [DICT] (2/1) > {A} [INT] : 1 +[DICT] (6/5) > {testdict3} [DICT] (2/2) > {D} [INT] : 4 +[DICT] (6/6) > {testlist} [LIST] (2/1) > [STR] : 'A1' +[DICT] (6/6) > {testlist} [LIST] (2/2) > [STR] : 'D4' +""" listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- @@ -2182,7 +2213,7 @@ listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- - +# -------------------------------------------------------------------------------------------------------------- diff --git a/test/testfiles/jpp-test_config_0510.jsonp b/test/testfiles/jpp-test_config_0510.jsonp new file mode 100644 index 00000000..fcf1558a --- /dev/null +++ b/test/testfiles/jpp-test_config_0510.jsonp @@ -0,0 +1,42 @@ +// Copyright 2020-2023 Robert Bosch GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//************************************************************************** +{ + "params" : { + "global" : { + "teststring_1" : "teststring_1.value", + ${params.global.teststring_1} : "${params.global.teststring_1}.suffix_1", + ${params.global.teststring_1} : "${params.global.teststring_1}.suffix_2", + ${params.global.teststring_1} : "prefix.${params.global.teststring_1}.suffix_3", + // + "teststring_2" : "teststring_2.value", + "teststring_2" : "${params.global.teststring_2}.suffix_1", + // + "teststring_3" : "teststring_3.value.1", + ${params.global.teststring_3} : "teststring_3.value.2", + "teststring_3" : "teststring_3.value.3", + ${params.global.teststring_3} : "teststring_3.value.4", + "teststring_3" : "teststring_3.value.5", + // + "testdict" : { + "key" : { + "teststring_4" : "teststring_4.initial_value" + } + }, + ${params.global.testdict.key.teststring_4} : "${params.global.testdict.key.teststring_4}.suffix_1", + ${params.global.testdict.key.teststring_4} : "${params.global.testdict.key.teststring_4}.suffix_2" + } + } +} + diff --git a/test/testfiles/jpp-test_config_0900.jsonp b/test/testfiles/jpp-test_config_0600.jsonp similarity index 52% rename from test/testfiles/jpp-test_config_0900.jsonp rename to test/testfiles/jpp-test_config_0600.jsonp index ce3e55ca..f9bbf7d9 100644 --- a/test/testfiles/jpp-test_config_0900.jsonp +++ b/test/testfiles/jpp-test_config_0600.jsonp @@ -13,6 +13,25 @@ // limitations under the License. //************************************************************************** { - // "I am" "syntax" "error" :: not ,,, detected - "param" : "value" + // "I am" "syntax" "error 1" :: not ,,, detected + // + /* "I am" "syntax" "error 2" :: not ,,, detected */ + // + "param1" : "value1", // comment + "param2" : "value2", /* comment */ + // + "testdict1" : {"A" : 1, // comment 1 + "B" : 2, // comment 2 + "C" : 3}, // comment 3 + + "testdict2" : {"A" : 1, // comment 1 + /* "B" : 2, */ + "C" : 3}, // comment 3 + + "testdict3" : {"A" : 1, // comment 1 + /* "B" : 2, + "C" : 3, */ + "D" : 4}, // comment 3 + // + "testlist" : ["A1", /*"B2", "C3",*/ "D4"] } \ No newline at end of file