@@ -813,74 +813,78 @@ def main(args):
813
813
814
814
print ("Test p-A is OK" )
815
815
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" )
841
847
842
848
print ("Test p is OK" )
843
849
844
850
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 (
846
853
uncr_bin ,
847
854
parsed_args ,
848
855
args_arr = ['-c' , '-' ,
849
856
'-f' , NULL_DEVICE ,
850
857
'-p' , '-' ],
851
858
out_expected_path = s_path_join (script_dir , 'output/pc-.txt' ),
852
859
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
+ )
856
862
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 )
861
865
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" )
864
869
865
870
print ("Test p and debug-csv-format option ..." )
866
871
#
867
872
# Test p and debug-csv-format option
868
873
#
869
- if os_name != 'nt' and not check_uncrustify_output (
874
+ if os_name != 'nt' :
875
+ return_value = check_uncrustify_output (
870
876
uncr_bin ,
871
877
parsed_args ,
872
878
args_arr = ['-c' , '-' ,
873
879
'-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' ),
875
881
'--debug-csv-format' ],
876
882
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
+
880
886
print ("Test p and debug-csv-format option is OK" )
881
887
882
- #G#config_D_R = parsed_args.config.lower()
883
- #G#print("config is", config_D_R)
884
888
if parsed_args .config .lower () == 'debug' :
885
889
print ("Test tracking space:FILE ..." )
886
890
#
@@ -890,18 +894,16 @@ def main(args):
890
894
print ("doesn't work under windows" )
891
895
else :
892
896
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 )
898
897
return_value = check_uncrustify_output (
899
898
uncr_bin ,
900
899
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 ],
902
903
gen_expected_path = s_path_join (script_dir , 'output/Debug_tracking_space.html' ),
903
904
gen_result_path = temp_result_path
904
905
)
906
+
905
907
if not return_value :
906
908
sys_exit (EX_SOFTWARE )
907
909
else :
@@ -946,14 +948,15 @@ def main(args):
946
948
return_value = check_uncrustify_output (
947
949
uncr_bin ,
948
950
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' ),
950
952
'--universalindent' ],
951
953
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' ),
953
955
gen_result_manip = [reg_replace (r'version=U.+' , '' ),
954
956
reg_replace (r'\(\d+\)' , '' ),
955
957
reg_replace (r'\r' , '' )]
956
958
)
959
+
957
960
# Issue 4379
958
961
if not return_value :
959
962
sys_exit (EX_SOFTWARE )
@@ -972,7 +975,7 @@ def main(args):
972
975
args_arr = ['-c' , NULL_DEVICE , '-L' , L , '-o' , NULL_DEVICE ,
973
976
'-f' , s_path_join (script_dir , 'input/testSrc.cpp' )],
974
977
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 ),
976
979
err_result_manip = [reg_replace (r'\([0-9]+\)' , ' ' ),
977
980
reg_replace (r'\:[0-9]+\)' , ' ' ),
978
981
reg_replace (r'\[line [0-9]+' , '[ ' ),
@@ -985,6 +988,7 @@ def main(args):
985
988
reg_replace (RE_DO_SPACE , '' ),
986
989
reg_replace (r'Chunk::' , '' )]
987
990
)
991
+
988
992
# Issue 4379
989
993
if not return_value :
990
994
sys_exit (EX_SOFTWARE )
@@ -1000,9 +1004,10 @@ def main(args):
1000
1004
# args_arr=['-c', NULL_DEVICE, '-L', '99', '-o', NULL_DEVICE,
1001
1005
# '-f', s_path_join(script_dir, 'input/logger.cs')],
1002
1006
# 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'),
1004
1008
# err_result_manip=reg_replace(r'[0-9]', '')
1005
1009
# )
1010
+
1006
1011
## Issue 4379
1007
1012
#if not return_value:
1008
1013
# sys_exit(EX_SOFTWARE)
@@ -1022,6 +1027,7 @@ def main(args):
1022
1027
err_expected_path = s_path_join (script_dir , 'output/%s.txt' % test ),
1023
1028
err_result_path = s_path_join (test_dir , 'results/%s.txt' % test )
1024
1029
)
1030
+
1025
1031
# Issue 4379
1026
1032
if not return_value :
1027
1033
sys_exit (EX_SOFTWARE )
@@ -1030,26 +1036,20 @@ def main(args):
1030
1036
1031
1037
print ("Test $(year) keyword ..." )
1032
1038
# 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
+ )
1044
1048
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 :
1051
1050
sys_exit (EX_SOFTWARE )
1052
1051
1052
+ print ("Test $(year) keyword is OK" )
1053
1053
1054
1054
if __name__ == "__main__" :
1055
1055
main (argv [1 :])
0 commit comments