Skip to content

Commit 4622946

Browse files
committed
test it untill -L
1 parent fbafab4 commit 4622946

File tree

1 file changed

+69
-69
lines changed

1 file changed

+69
-69
lines changed

tests/cli/test_cli_options.py

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -813,74 +813,78 @@ def main(args):
813813

814814
print("Test p-A is OK")
815815

816-
#return_value = check_uncrustify_output(
817-
# uncr_bin,
818-
# parsed_args,
819-
# args_arr=['-f', s_path_join(script_dir, 'input/class_enum_struct_union.cpp'),
820-
# '-p', s_path_join(test_dir, 'results/class_enum_struct_union.txt')],
821-
# gen_expected_path=s_path_join(script_dir, 'output/class_enum_struct_union.txt'),
822-
# gen_result_path=s_path_join(script_dir, 'results/class_enum_struct_union.txt'),
823-
# gen_result_manip=reg_replace(r'\# Uncrustify.+[^\n\r]', '')
824-
# )
825-
## Issue 4379
826-
#if not return_value:
827-
# sys_exit(EX_SOFTWARE)
828-
829-
#return_value = check_uncrustify_output(
830-
# uncr_bin,
831-
# parsed_args,
832-
# args_arr=['-f', s_path_join(script_dir, 'input/in_fcn_def.cpp'),
833-
# '-p', s_path_join(test_dir, 'results/in_fcn_def.txt')],
834-
# gen_expected_path=s_path_join(script_dir, 'output/in_fcn_def.txt'),
835-
# gen_result_path=s_path_join(test_dir, 'results/in_fcn_def.txt'),
836-
# gen_result_manip=reg_replace(r'\# Uncrustify.+[^\n\r]', '')
837-
# )
838-
## Issue 4379
839-
#if not return_value:
840-
# sys_exit(EX_SOFTWARE)
816+
return_value = check_uncrustify_output(
817+
uncr_bin,
818+
parsed_args,
819+
args_arr=['-f', s_path_join(script_dir, 'input/class_enum_struct_union.cpp'),
820+
'-p', s_path_join(script_dir, 'results/class_enum_struct_union.txt')],
821+
gen_expected_path=s_path_join(script_dir, 'output/class_enum_struct_union.txt'),
822+
gen_result_path=s_path_join(script_dir, 'results/class_enum_struct_union.txt'),
823+
gen_result_manip=reg_replace(r'\# Uncrustify.+[^\n\r]', '')
824+
)
825+
826+
# Issue 4379
827+
if not return_value:
828+
sys_exit(EX_SOFTWARE)
829+
830+
print("Test p-B is OK")
831+
832+
return_value = check_uncrustify_output(
833+
uncr_bin,
834+
parsed_args,
835+
args_arr=['-f', s_path_join(script_dir, 'input/in_fcn_def.cpp'),
836+
'-p', s_path_join(script_dir, 'results/in_fcn_def.txt')],
837+
gen_expected_path=s_path_join(script_dir, 'output/in_fcn_def.txt'),
838+
gen_result_path=s_path_join(script_dir, 'results/in_fcn_def.txt'),
839+
gen_result_manip=reg_replace(r'\# Uncrustify.+[^\n\r]', '')
840+
)
841+
842+
# Issue 4379
843+
if not return_value:
844+
sys_exit(EX_SOFTWARE)
845+
846+
print("Test p-C is OK")
841847

842848
print("Test p is OK")
843849

844850
print("Test p and -c with '-' input ...")
845-
if os_name == 'nt' or check_uncrustify_output(
851+
if os_name == 'nt':
852+
return_value = check_uncrustify_output(
846853
uncr_bin,
847854
parsed_args,
848855
args_arr=['-c', '-',
849856
'-f', NULL_DEVICE,
850857
'-p', '-'],
851858
out_expected_path=s_path_join(script_dir, 'output/pc-.txt'),
852859
out_result_manip=reg_replace(r'\# Uncrustify.+[^\n\r]', ''),
853-
out_result_path=s_path_join(test_dir, 'results/pc-.txt')
854-
):
855-
pass
860+
out_result_path=s_path_join(script_dir, 'results/pc-.txt')
861+
)
856862

857-
#print("Test p and -c with '-' input ...")
858-
#
859-
# Test p and -c with '-' input
860-
#
863+
if not return_value:
864+
sys_exit(EX_SOFTWARE)
861865
else:
862-
return_flag = False
863-
#print("Test p and -c with '-' input is OK")
866+
print("nothing to do")
867+
868+
print("Test p and -c with '-' input ... is OK")
864869

865870
print("Test p and debug-csv-format option ...")
866871
#
867872
# Test p and debug-csv-format option
868873
#
869-
if os_name != 'nt' and not check_uncrustify_output(
874+
if os_name != 'nt':
875+
return_value = check_uncrustify_output(
870876
uncr_bin,
871877
parsed_args,
872878
args_arr=['-c', '-',
873879
'-f', s_path_join(script_dir, 'input/class_enum_struct_union.cpp'),
874-
'-p', s_path_join(test_dir, 'results/class_enum_struct_union.csv'),
880+
'-p', s_path_join(script_dir, 'results/class_enum_struct_union.csv'),
875881
'--debug-csv-format'],
876882
gen_expected_path=s_path_join(script_dir, 'output/class_enum_struct_union.csv'),
877-
gen_result_path=s_path_join(test_dir, 'results/class_enum_struct_union.csv'),
878-
):
879-
return_flag = False
883+
gen_result_path=s_path_join(script_dir, 'results/class_enum_struct_union.csv'),
884+
)
885+
880886
print("Test p and debug-csv-format option is OK")
881887

882-
#G#config_D_R = parsed_args.config.lower()
883-
#G#print("config is", config_D_R)
884888
if parsed_args.config.lower() == 'debug':
885889
print("Test tracking space:FILE ...")
886890
#
@@ -890,18 +894,16 @@ def main(args):
890894
print("doesn't work under windows")
891895
else:
892896
temp_result_path = s_path_join(script_dir, 'results/Debug_tracking_space.html')
893-
args_arr=['-c', s_path_join(script_dir, 'config/tracking_space.cfg'),
894-
'-f', s_path_join(script_dir, 'input/tracking_space.cpp'),
895-
'--tracking', "space:" + temp_result_path
896-
]
897-
print(args_arr)
898897
return_value = check_uncrustify_output(
899898
uncr_bin,
900899
parsed_args,
901-
args_arr,
900+
args_arr=['-c', s_path_join(script_dir, 'config/tracking_space.cfg'),
901+
'-f', s_path_join(script_dir, 'input/tracking_space.cpp'),
902+
'--tracking', "space:" + temp_result_path],
902903
gen_expected_path=s_path_join(script_dir, 'output/Debug_tracking_space.html'),
903904
gen_result_path=temp_result_path
904905
)
906+
905907
if not return_value:
906908
sys_exit(EX_SOFTWARE)
907909
else:
@@ -946,14 +948,15 @@ def main(args):
946948
return_value = check_uncrustify_output(
947949
uncr_bin,
948950
parsed_args,
949-
args_arr=['-o', s_path_join(test_dir, 'results/universalindent.cfg'),
951+
args_arr=['-o', s_path_join(script_dir, 'results/universalindent.cfg'),
950952
'--universalindent'],
951953
gen_expected_path=s_path_join(script_dir, 'output/universalindent.cfg'),
952-
gen_result_path=s_path_join(test_dir, 'results/universalindent.cfg'),
954+
gen_result_path=s_path_join(script_dir, 'results/universalindent.cfg'),
953955
gen_result_manip=[reg_replace(r'version=U.+', ''),
954956
reg_replace(r'\(\d+\)', ''),
955957
reg_replace(r'\r', '')]
956958
)
959+
957960
# Issue 4379
958961
if not return_value:
959962
sys_exit(EX_SOFTWARE)
@@ -972,7 +975,7 @@ def main(args):
972975
args_arr=['-c', NULL_DEVICE, '-L', L, '-o', NULL_DEVICE,
973976
'-f', s_path_join(script_dir, 'input/testSrc.cpp')],
974977
err_expected_path=s_path_join(script_dir, 'output/%s.txt' % L),
975-
err_result_path=s_path_join(test_dir, 'results/%s.txt' % L),
978+
err_result_path=s_path_join(script_dir, 'results/%s.txt' % L),
976979
err_result_manip=[reg_replace(r'\([0-9]+\)', ' '),
977980
reg_replace(r'\:[0-9]+\)', ' '),
978981
reg_replace(r'\[line [0-9]+', '[ '),
@@ -985,6 +988,7 @@ def main(args):
985988
reg_replace(RE_DO_SPACE, ''),
986989
reg_replace(r'Chunk::', '')]
987990
)
991+
988992
# Issue 4379
989993
if not return_value:
990994
sys_exit(EX_SOFTWARE)
@@ -1000,9 +1004,10 @@ def main(args):
10001004
# args_arr=['-c', NULL_DEVICE, '-L', '99', '-o', NULL_DEVICE,
10011005
# '-f', s_path_join(script_dir, 'input/logger.cs')],
10021006
# err_expected_path=s_path_join(script_dir, 'output/logger_cs_L_99.txt'),
1003-
# err_result_path=s_path_join(test_dir, 'results/logger_cs_L_99.txt'),
1007+
# err_result_path=s_path_join(script_dir, 'results/logger_cs_L_99.txt'),
10041008
# err_result_manip=reg_replace(r'[0-9]', '')
10051009
# )
1010+
10061011
## Issue 4379
10071012
#if not return_value:
10081013
# sys_exit(EX_SOFTWARE)
@@ -1022,6 +1027,7 @@ def main(args):
10221027
err_expected_path=s_path_join(script_dir, 'output/%s.txt' % test),
10231028
err_result_path=s_path_join(test_dir, 'results/%s.txt' % test)
10241029
)
1030+
10251031
# Issue 4379
10261032
if not return_value:
10271033
sys_exit(EX_SOFTWARE)
@@ -1030,26 +1036,20 @@ def main(args):
10301036

10311037
print("Test $(year) keyword ...")
10321038
# Test $(year) keyword (issue #3251)
1033-
if not check_uncrustify_output(
1034-
uncr_bin,
1035-
parsed_args,
1036-
args_arr=['-c', s_path_join(script_dir, 'config/copyright-header.cfg'),
1037-
'-f', s_path_join(script_dir, 'input/testSrc.cpp')],
1038-
out_expected_path=s_path_join(script_dir, 'output/copyright-header.cpp'),
1039-
out_result_path=s_path_join(test_dir, 'results/copyright-header.cpp'),
1040-
out_result_manip=string_replace(str(date.today().year), 'this year'),
1041-
):
1042-
return_flag = False
1043-
print("Test $(year) keyword is OK")
1039+
return_value = check_uncrustify_output(
1040+
uncr_bin,
1041+
parsed_args,
1042+
args_arr=['-c', s_path_join(script_dir, 'config/copyright-header.cfg'),
1043+
'-f', s_path_join(script_dir, 'input/testSrc.cpp')],
1044+
out_expected_path=s_path_join(script_dir, 'output/copyright-header.cpp'),
1045+
out_result_path=s_path_join(script_dir, 'results/copyright-header.cpp'),
1046+
out_result_manip=string_replace(str(date.today().year), 'this year'),
1047+
)
10441048

1045-
return_flag = True
1046-
if return_flag:
1047-
print("all tests are OK")
1048-
sys_exit(EX_OK)
1049-
else:
1050-
print("some problem(s) are still present")
1049+
if not return_value:
10511050
sys_exit(EX_SOFTWARE)
10521051

1052+
print("Test $(year) keyword is OK")
10531053

10541054
if __name__ == "__main__":
10551055
main(argv[1:])

0 commit comments

Comments
 (0)