Apply pretty print tool.
Apply on each class in test suite and library.
This commit is contained in:
@@ -11,6 +11,7 @@ class
|
||||
TEST_JSON_SUITE
|
||||
|
||||
inherit
|
||||
|
||||
EQA_TEST_SET
|
||||
redefine
|
||||
on_prepare
|
||||
@@ -27,38 +28,38 @@ feature {NONE} -- Events
|
||||
feature -- Tests Pass
|
||||
|
||||
test_json_pass1
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("pass1.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("pass1.json",parse_json.is_parsed = True)
|
||||
assert ("pass1.json", parse_json.is_parsed = True)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_pass2
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("pass2.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("pass2.json",parse_json.is_parsed = True)
|
||||
assert ("pass2.json", parse_json.is_parsed = True)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_pass3
|
||||
--
|
||||
test_json_pass3
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("pass3.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("pass3.json",parse_json.is_parsed = True)
|
||||
assert ("pass3.json", parse_json.is_parsed = True)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,14 +70,10 @@ feature -- Tests Pass
|
||||
s: READABLE_STRING_32
|
||||
do
|
||||
s := {STRING_32} "{ %"nihaoma%": %"你好吗\t?%" }"
|
||||
|
||||
parse_json := new_json_parser (utf.string_32_to_utf_8_string_8 (s))
|
||||
json_value := parse_json.parse_json
|
||||
assert ("utf8.pass1.json", parse_json.is_parsed = True)
|
||||
if
|
||||
attached {JSON_OBJECT} json_value as jo and then
|
||||
attached {JSON_STRING} jo.item ("nihaoma") as js
|
||||
then
|
||||
if attached {JSON_OBJECT} json_value as jo and then attached {JSON_STRING} jo.item ("nihaoma") as js then
|
||||
assert ("utf8.nihaoma", js.unescaped_string_32.same_string ({STRING_32} "你好吗%T?"))
|
||||
else
|
||||
assert ("utf8.nihaoma", False)
|
||||
@@ -84,408 +81,400 @@ feature -- Tests Pass
|
||||
end
|
||||
|
||||
feature -- Tests Failures
|
||||
test_json_fail1
|
||||
--
|
||||
|
||||
test_json_fail1
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail1.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail1.json",parse_json.is_parsed = False)
|
||||
assert ("fail1.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail2
|
||||
--
|
||||
test_json_fail2
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail2.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail2.json",parse_json.is_parsed = False)
|
||||
assert ("fail2.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail3
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail3.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail3.json",parse_json.is_parsed = False)
|
||||
assert ("fail3.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail4
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail4.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail4.json",parse_json.is_parsed = False)
|
||||
assert ("fail4.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail5
|
||||
--
|
||||
test_json_fail5
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail5.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail5.json",parse_json.is_parsed = False)
|
||||
assert ("fail5.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail6
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail6.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail6.json",parse_json.is_parsed = False )
|
||||
assert ("fail6.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail7
|
||||
--
|
||||
test_json_fail7
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail7.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail7.json",parse_json.is_parsed = False)
|
||||
assert ("fail7.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail8
|
||||
--
|
||||
test_json_fail8
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail8.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail8.json",parse_json.is_parsed = False )
|
||||
assert ("fail8.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail9
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail9.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail9.json",parse_json.is_parsed = False)
|
||||
assert ("fail9.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail10
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail10.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail10.json",parse_json.is_parsed = False)
|
||||
assert ("fail10.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail11
|
||||
--
|
||||
test_json_fail11
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail11.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail11.json",parse_json.is_parsed = False)
|
||||
assert ("fail11.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail12
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail12.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail12.json",parse_json.is_parsed = False)
|
||||
assert ("fail12.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail13
|
||||
--
|
||||
test_json_fail13
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail13.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail13.json",parse_json.is_parsed = False)
|
||||
assert ("fail13.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail14
|
||||
--
|
||||
test_json_fail14
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail14.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail14.json",parse_json.is_parsed = False)
|
||||
assert ("fail14.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail15
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail15.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail15.json",parse_json.is_parsed = False)
|
||||
assert ("fail15.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail16
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail16.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail16.json",parse_json.is_parsed = False)
|
||||
assert ("fail16.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail17
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail17.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail17.json",parse_json.is_parsed = False)
|
||||
assert ("fail17.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail18
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail18.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail18.json",parse_json.is_parsed = True)
|
||||
assert ("fail18.json", parse_json.is_parsed = True)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail19
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail19.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail19.json",parse_json.is_parsed = False)
|
||||
assert ("fail19.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail20
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail20.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail20.json",parse_json.is_parsed = False)
|
||||
assert ("fail20.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail21
|
||||
--
|
||||
test_json_fail21
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail21.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail21.json",parse_json.is_parsed = False)
|
||||
assert ("fail21.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail22
|
||||
--
|
||||
test_json_fail22
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail22.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail22.json",parse_json.is_parsed = False)
|
||||
assert ("fail22.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail23
|
||||
--
|
||||
test_json_fail23
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail23.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail23.json",parse_json.is_parsed = False)
|
||||
assert ("fail23.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail24
|
||||
--
|
||||
test_json_fail24
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail24.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail24.json",parse_json.is_parsed = False)
|
||||
assert ("fail24.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail25
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail25.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail25.json",parse_json.is_parsed = False)
|
||||
assert ("fail25.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail26
|
||||
--
|
||||
test_json_fail26
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail26.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail26.json",parse_json.is_parsed = False)
|
||||
assert ("fail26.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail27
|
||||
--
|
||||
test_json_fail27
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail27.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail27.json",parse_json.is_parsed = False)
|
||||
assert ("fail27.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail28
|
||||
--
|
||||
test_json_fail28
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail28.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail28.json",parse_json.is_parsed = False)
|
||||
assert ("fail28.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail29
|
||||
--
|
||||
test_json_fail29
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail29.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail29.json",parse_json.is_parsed = False )
|
||||
assert ("fail29.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
test_json_fail30
|
||||
--
|
||||
test_json_fail30
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail30.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail30.json",parse_json.is_parsed = False)
|
||||
assert ("fail30.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail31
|
||||
--
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail31.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail31.json",parse_json.is_parsed = False)
|
||||
assert ("fail31.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail32
|
||||
--
|
||||
test_json_fail32
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail32.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail32.json",parse_json.is_parsed = False)
|
||||
assert ("fail32.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
test_json_fail33
|
||||
--
|
||||
test_json_fail33
|
||||
--
|
||||
local
|
||||
parse_json: like new_json_parser
|
||||
do
|
||||
if attached json_file_from ("fail33.json") as json_file then
|
||||
parse_json := new_json_parser (json_file)
|
||||
json_value := parse_json.parse_json
|
||||
assert ("fail33.json",parse_json.is_parsed = False)
|
||||
assert ("fail33.json", parse_json.is_parsed = False)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -495,23 +484,22 @@ feature -- JSON_FROM_FILE
|
||||
|
||||
json_value: detachable JSON_VALUE
|
||||
|
||||
json_file_from (fn: STRING): detachable STRING
|
||||
local
|
||||
f: RAW_FILE
|
||||
l_path: STRING
|
||||
json_file_from (fn: STRING): detachable STRING
|
||||
local
|
||||
f: RAW_FILE
|
||||
l_path: STRING
|
||||
test_dir: STRING
|
||||
i: INTEGER
|
||||
do
|
||||
test_dir := (create {EXECUTION_ENVIRONMENT}).current_working_directory
|
||||
test_dir.append_character ((create {OPERATING_ENVIRONMENT}).directory_separator)
|
||||
|
||||
l_path := test_dir + fn
|
||||
create f.make_with_name (l_path)
|
||||
if f.exists then
|
||||
-- Found json file
|
||||
else
|
||||
-- before EiffelStudio 7.3 , the current dir of autotest execution was not the parent dir of ecf but something like
|
||||
-- ..json\test\autotest\test_suite\EIFGENs\test_suite\Testing\execution\TEST_JSON_SUITE.test_json_fail1\..\..\..\..\..\fail1.json
|
||||
-- before EiffelStudio 7.3 , the current dir of autotest execution was not the parent dir of ecf but something like
|
||||
-- ..json\test\autotest\test_suite\EIFGENs\test_suite\Testing\execution\TEST_JSON_SUITE.test_json_fail1\..\..\..\..\..\fail1.json
|
||||
from
|
||||
i := 5
|
||||
until
|
||||
@@ -536,9 +524,7 @@ feature -- JSON_FROM_FILE
|
||||
create Result.make_parser (a_string)
|
||||
end
|
||||
|
||||
|
||||
invariant
|
||||
file_reader /= Void
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user