-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write system tests for
lobster-json
regarding directory input
- Add a requirement to specify the behavior when a directory is specified as input - Add system tests
- Loading branch information
Showing
20 changed files
with
204 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package json_req | ||
import req | ||
/* | ||
req.System_Requirement Parse_Input_File { | ||
description = ''' | ||
IF a list element given through the command line option "FILE_OR_DIR" is a file, | ||
|
||
(OTHERWISE, the tool shall exit with a non-zero return code.) | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_JSON_Extension { | ||
description = ''' | ||
AND if the file extension is "json" (case-insensitive), | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_Valid_JSON { | ||
description = ''' | ||
AND if the file content is valid JSON, | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_Input_Items { | ||
description = ''' | ||
THEN each key-value pair of the outer-most dictionary of the JSON data struct | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_To_Lobster { | ||
description = ''' | ||
SHALL be written in the LOBSTER interchange format | ||
''' | ||
} | ||
|
||
// missing aspect: how to convert (i.e. what is the item name)? | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_To_Stdout { | ||
description = ''' | ||
to the file given in the command line option "out", | ||
IF that option is given and is not an empty string, | ||
''' | ||
} | ||
|
||
req.System_Requirement_Aspect Parse_Input_File_To_File { | ||
description = ''' | ||
OTHERWISE to STDOUT. | ||
''' | ||
} | ||
*/ |
1 change: 1 addition & 0 deletions
1
tests-system/lobster-json/rbt-directory-input/non-json-input/expected-output/exit-code.txt
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 @@ | ||
0 |
24 changes: 24 additions & 0 deletions
24
tests-system/lobster-json/rbt-directory-input/non-json-input/expected-output/output.lobster
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,24 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"tag": "json ./file.json:tree on island", | ||
"location": { | ||
"kind": "file", | ||
"file": "./file.json", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "./file.json:tree on island", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
} | ||
], | ||
"generator": "lobster-json", | ||
"schema": "lobster-act-trace", | ||
"version": 3 | ||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
tests-system/lobster-json/rbt-directory-input/non-json-input/expected-output/stdout.txt
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 @@ | ||
lobster-json: wrote 1 items to output.lobster |
5 changes: 5 additions & 0 deletions
5
tests-system/lobster-json/rbt-directory-input/non-json-input/input/args.txt
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,5 @@ | ||
--single | ||
--tag-attribute=something | ||
--name-attribute=name | ||
--out=output.lobster | ||
dir1 |
1 change: 1 addition & 0 deletions
1
...s-system/lobster-json/rbt-directory-input/two-level-nesting/expected-output/exit-code.txt
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 @@ | ||
0 |
58 changes: 58 additions & 0 deletions
58
...-system/lobster-json/rbt-directory-input/two-level-nesting/expected-output/output.lobster
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,58 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"tag": "json ./dir1/dir2/deeply-nested.json:dir1.dir2.deeply-nested.1", | ||
"location": { | ||
"kind": "file", | ||
"file": "./dir1/dir2/deeply-nested.json", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "./dir1/dir2/deeply-nested.json:dir1.dir2.deeply-nested.1", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
}, | ||
{ | ||
"tag": "json ./dir1/nested.json:dir1.nested.1", | ||
"location": { | ||
"kind": "file", | ||
"file": "./dir1/nested.json", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "./dir1/nested.json:dir1.nested.1", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
}, | ||
{ | ||
"tag": "json ./file.json:file.1", | ||
"location": { | ||
"kind": "file", | ||
"file": "./file.json", | ||
"line": null, | ||
"column": null | ||
}, | ||
"name": "./file.json:file.1", | ||
"messages": [], | ||
"just_up": [], | ||
"just_down": [], | ||
"just_global": [], | ||
"framework": "JSON", | ||
"kind": "Test Vector", | ||
"status": null | ||
} | ||
], | ||
"generator": "lobster-json", | ||
"schema": "lobster-act-trace", | ||
"version": 3 | ||
} |
Empty file.
1 change: 1 addition & 0 deletions
1
tests-system/lobster-json/rbt-directory-input/two-level-nesting/expected-output/stdout.txt
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 @@ | ||
lobster-json: wrote 3 items to output.lobster |
3 changes: 3 additions & 0 deletions
3
tests-system/lobster-json/rbt-directory-input/two-level-nesting/input/args.txt
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,3 @@ | ||
--single | ||
--tag-attribute=something | ||
--out=output.lobster |
9 changes: 9 additions & 0 deletions
9
...tem/lobster-json/rbt-directory-input/two-level-nesting/input/dir1/dir2/deeply-nested.json
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,9 @@ | ||
{ | ||
"cherry": { | ||
"data": [ | ||
{ | ||
"name": "element three" | ||
} | ||
] | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests-system/lobster-json/rbt-directory-input/two-level-nesting/input/dir1/nested.json
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,9 @@ | ||
{ | ||
"banana": { | ||
"data": [ | ||
{ | ||
"name": "element two" | ||
} | ||
] | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests-system/lobster-json/rbt-directory-input/two-level-nesting/input/file.json
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,9 @@ | ||
{ | ||
"apple": { | ||
"data": [ | ||
{ | ||
"name": "element one" | ||
} | ||
] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/README.md
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,3 @@ | ||
The input file of this test defines a JSON data struct which has got data items in its | ||
outer-most dictionary, as well as nested items. | ||
According to the requirement only the data items from the outer-most dictionary must be considered. |
1 change: 1 addition & 0 deletions
1
...bster-json/rbt-parse-input-file-input-items/outer-and-inner/expected-output/exit-code.txt
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 @@ | ||
0 |
Empty file.
1 change: 1 addition & 0 deletions
1
.../lobster-json/rbt-parse-input-file-input-items/outer-and-inner/expected-output/stdout.txt
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 @@ | ||
lobster-json: wrote 1 items to output.lobster |
3 changes: 3 additions & 0 deletions
3
tests-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/input/args.txt
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,3 @@ | ||
--single | ||
--tag-attribute=something | ||
--out=output.lobster |
25 changes: 25 additions & 0 deletions
25
tests-system/lobster-json/rbt-parse-input-file-input-items/outer-and-inner/input/data.json
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,25 @@ | ||
{ | ||
"outer1": { | ||
"data": [ | ||
{ | ||
"name": "Take this item!" | ||
}, | ||
{ | ||
|
||
"name": "unclear" | ||
} | ||
] | ||
}, | ||
"outer2": { | ||
"data": [ | ||
{ | ||
"name": "Take this item!" | ||
}, | ||
{ | ||
|
||
"name": "unclear" | ||
} | ||
] | ||
} | ||
} | ||
|