Pārlūkot izejas kodu

Sweep colored words under the variable carpet

Alois Mahdal 6 gadus atpakaļ
vecāks
revīzija
80b5fdb845
1 mainītis faili ar 32 papildinājumiem un 14 dzēšanām
  1. 32
    14
      src/jat.sh.skel

+ 32
- 14
src/jat.sh.skel Parādīt failu

@@ -74,6 +74,24 @@ JAT__TESTID=${JAT__TESTID:-_jat_anon_test_}
74 74
 #
75 75
 __JAT__SDIR=
76 76
 
77
+#
78
+# Colored words for `jat__show_*` functions
79
+#
80
+__JAT__SWORD_END=${TERMCOLORS_LBLACK}END${TERMCOLORS_NONE}
81
+__JAT__SWORD_FAIL=${TERMCOLORS_RED}FAIL${TERMCOLORS_NONE}
82
+__JAT__SWORD_FINALIZE=${TERMCOLORS_LBLACK}FINALIZE${TERMCOLORS_NONE}
83
+__JAT__SWORD_PASS=${TERMCOLORS_GREEN}PASS${TERMCOLORS_NONE}
84
+__JAT__SWORD_PHASE=${TERMCOLORS_YELLOW}phase${TERMCOLORS_NONE}
85
+__JAT__SWORD_RELOAD=${TERMCOLORS_LBLUE}RELOAD${TERMCOLORS_NONE}
86
+__JAT__SWORD_SESSION=${TERMCOLORS_YELLOW}session${TERMCOLORS_NONE}
87
+__JAT__SWORD_START=${TERMCOLORS_LBLACK}START${TERMCOLORS_NONE}
88
+__JAT__SWORD_SUT=${TERMCOLORS_YELLOW}sut${TERMCOLORS_NONE}
89
+__JAT__SWORD_TERROR=${TERMCOLORS_RED}ERROR${TERMCOLORS_NONE}
90
+__JAT__SWORD_TEST=${TERMCOLORS_YELLOW}test${TERMCOLORS_NONE}
91
+__JAT__SWORD_TINFO=${TERMCOLORS_LBLACK}INFO${TERMCOLORS_NONE}
92
+__JAT__SWORD_TWARNING=${TERMCOLORS_RED}WARNING${TERMCOLORS_NONE}
93
+
94
+
77 95
 #
78 96
 # Make result log deterministic?
79 97
 #
@@ -1021,7 +1039,7 @@ __jat__show_fail() {
1021 1039
     # Show assert fail message $1 to stderr
1022 1040
     #
1023 1041
     __jat__show \
1024
-        "  ${TERMCOLORS_YELLOW}sut${TERMCOLORS_NONE}.${TERMCOLORS_RED}FAIL${TERMCOLORS_NONE}: $1"
1042
+        "  $__JAT__SWORD_SUT.$__JAT__SWORD_FAIL: $1"
1025 1043
 }
1026 1044
 
1027 1045
 __jat__show_pass() {
@@ -1029,7 +1047,7 @@ __jat__show_pass() {
1029 1047
     # Show assert fail message $1 to stderr
1030 1048
     #
1031 1049
     __jat__show \
1032
-        "  ${TERMCOLORS_YELLOW}sut${TERMCOLORS_NONE}.${TERMCOLORS_GREEN}PASS${TERMCOLORS_NONE}: $1"
1050
+        "  $__JAT__SWORD_SUT.$__JAT__SWORD_PASS: $1"
1033 1051
 }
1034 1052
 
1035 1053
 __jat__show_pend() {
@@ -1042,11 +1060,11 @@ __jat__show_pend() {
1042 1060
     pname=$(__jat__sd_keyr P.name)
1043 1061
     test "$pname" == "_jat_anon_phase_" || pnhint=" '$pname'"
1044 1062
     case "$(jat__stat pfailc)" in
1045
-        0)  pverd="${TERMCOLORS_GREEN}PASS${TERMCOLORS_NONE}" ;; 
1046
-        *)  pverd="${TERMCOLORS_RED}FAIL${TERMCOLORS_NONE}" ;;
1063
+        0)  pverd="$__JAT__SWORD_PASS" ;;
1064
+        *)  pverd="$__JAT__SWORD_FAIL" ;;
1047 1065
     esac
1048 1066
     __jat__show \
1049
-        "${TERMCOLORS_YELLOW}phase${TERMCOLORS_NONE}.${TERMCOLORS_LBLACK}END${TERMCOLORS_NONE}.$pverd$pnhint" \
1067
+        "$__JAT__SWORD_PHASE.$__JAT__SWORD_END.$pverd$pnhint" \
1050 1068
         ""
1051 1069
 }
1052 1070
 
@@ -1058,7 +1076,7 @@ __jat__show_pstart() {
1058 1076
     local pnhint    # ^^ ^^ display
1059 1077
     test "$pname" == "_jat_anon_phase_" || pnhint=" '$pname'"
1060 1078
     __jat__show \
1061
-        "${TERMCOLORS_YELLOW}phase${TERMCOLORS_NONE}.${TERMCOLORS_LBLACK}START${TERMCOLORS_NONE}$pnhint"
1079
+        "$__JAT__SWORD_PHASE.$__JAT__SWORD_START$pnhint"
1062 1080
 }
1063 1081
 
1064 1082
 __jat__show_sfinish() {
@@ -1067,11 +1085,11 @@ __jat__show_sfinish() {
1067 1085
     #
1068 1086
     local sverd         # session verdict text
1069 1087
     case "$(jat__stat sfailc)" in
1070
-        0)  sverd="${TERMCOLORS_GREEN}PASS${TERMCOLORS_NONE}" ;; 
1071
-        *)  sverd="${TERMCOLORS_RED}FAIL${TERMCOLORS_NONE}" ;;
1088
+        0)  sverd="$__JAT__SWORD_PASS" ;;
1089
+        *)  sverd="$__JAT__SWORD_FAIL" ;;
1072 1090
     esac
1073 1091
     __jat__show \
1074
-        "${TERMCOLORS_YELLOW}session${TERMCOLORS_NONE}.${TERMCOLORS_LBLACK}FINALIZE${TERMCOLORS_NONE}.$sverd"
1092
+        "$__JAT__SWORD_SESSION.$__JAT__SWORD_FINALIZE.$sverd"
1075 1093
 }
1076 1094
 
1077 1095
 __jat__show_sinitn() {
@@ -1079,7 +1097,7 @@ __jat__show_sinitn() {
1079 1097
     # Show message about session initialization to stderr
1080 1098
     #
1081 1099
     __jat__show \
1082
-        "${TERMCOLORS_YELLOW}session${TERMCOLORS_NONE}.${TERMCOLORS_LBLACK}START${TERMCOLORS_NONE}" \
1100
+        "$__JAT__SWORD_SESSION.$__JAT__SWORD_START" \
1083 1101
         ""
1084 1102
 }
1085 1103
 
@@ -1088,7 +1106,7 @@ __jat__show_sinitr() {
1088 1106
     # Show message about session reload to stderr
1089 1107
     #
1090 1108
     __jat__show \
1091
-        "${TERMCOLORS_YELLOW}session${TERMCOLORS_NONE}.${TERMCOLORS_LBLUE}RELOAD${TERMCOLORS_NONE}" \
1109
+        "$__JAT__SWORD_SESSION.$__JAT__SWORD_RELOAD" \
1092 1110
         ""
1093 1111
 }
1094 1112
 
@@ -1099,7 +1117,7 @@ __jat__show_tinfo() {
1099 1117
     local sp=""
1100 1118
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1101 1119
     __jat__show \
1102
-        "$sp${TERMCOLORS_YELLOW}test${TERMCOLORS_NONE}.${TERMCOLORS_LBLACK}INFO${TERMCOLORS_NONE}: $1"
1120
+        "$sp$__JAT__SWORD_TEST.$__JAT__SWORD_TINFO: $1"
1103 1121
 }
1104 1122
 
1105 1123
 __jat__show_terror() {
@@ -1109,7 +1127,7 @@ __jat__show_terror() {
1109 1127
     local sp=""
1110 1128
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1111 1129
     __jat__show \
1112
-        "$sp${TERMCOLORS_YELLOW}test${TERMCOLORS_NONE}.${TERMCOLORS_RED}ERROR${TERMCOLORS_NONE}: $1"
1130
+        "$sp$__JAT__SWORD_TEST.$__JAT__SWORD_TERROR: $1"
1113 1131
 }
1114 1132
 
1115 1133
 __jat__show_twarning() {
@@ -1119,7 +1137,7 @@ __jat__show_twarning() {
1119 1137
     local sp=""
1120 1138
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1121 1139
     __jat__show \
1122
-        "$sp${TERMCOLORS_YELLOW}test${TERMCOLORS_NONE}.${TERMCOLORS_RED}WARNING${TERMCOLORS_NONE}: $1"
1140
+        "$sp$__JAT__SWORD_TEST.$__JAT__SWORD_TWARNING: $1"
1123 1141
 }
1124 1142
 
1125 1143
 __jat__show_error() {