Browse Source

Sweep colored words under the variable carpet

Alois Mahdal 6 years ago
parent
commit
80b5fdb845
1 changed files with 32 additions and 14 deletions
  1. 32
    14
      src/jat.sh.skel

+ 32
- 14
src/jat.sh.skel View File

74
 #
74
 #
75
 __JAT__SDIR=
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
 # Make result log deterministic?
96
 # Make result log deterministic?
79
 #
97
 #
1021
     # Show assert fail message $1 to stderr
1039
     # Show assert fail message $1 to stderr
1022
     #
1040
     #
1023
     __jat__show \
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
 __jat__show_pass() {
1045
 __jat__show_pass() {
1029
     # Show assert fail message $1 to stderr
1047
     # Show assert fail message $1 to stderr
1030
     #
1048
     #
1031
     __jat__show \
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
 __jat__show_pend() {
1053
 __jat__show_pend() {
1042
     pname=$(__jat__sd_keyr P.name)
1060
     pname=$(__jat__sd_keyr P.name)
1043
     test "$pname" == "_jat_anon_phase_" || pnhint=" '$pname'"
1061
     test "$pname" == "_jat_anon_phase_" || pnhint=" '$pname'"
1044
     case "$(jat__stat pfailc)" in
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
     esac
1065
     esac
1048
     __jat__show \
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
     local pnhint    # ^^ ^^ display
1076
     local pnhint    # ^^ ^^ display
1059
     test "$pname" == "_jat_anon_phase_" || pnhint=" '$pname'"
1077
     test "$pname" == "_jat_anon_phase_" || pnhint=" '$pname'"
1060
     __jat__show \
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
 __jat__show_sfinish() {
1082
 __jat__show_sfinish() {
1067
     #
1085
     #
1068
     local sverd         # session verdict text
1086
     local sverd         # session verdict text
1069
     case "$(jat__stat sfailc)" in
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
     esac
1090
     esac
1073
     __jat__show \
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
 __jat__show_sinitn() {
1095
 __jat__show_sinitn() {
1079
     # Show message about session initialization to stderr
1097
     # Show message about session initialization to stderr
1080
     #
1098
     #
1081
     __jat__show \
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
     # Show message about session reload to stderr
1106
     # Show message about session reload to stderr
1089
     #
1107
     #
1090
     __jat__show \
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
     local sp=""
1117
     local sp=""
1100
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1118
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1101
     __jat__show \
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
 __jat__show_terror() {
1123
 __jat__show_terror() {
1109
     local sp=""
1127
     local sp=""
1110
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1128
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1111
     __jat__show \
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
 __jat__show_twarning() {
1133
 __jat__show_twarning() {
1119
     local sp=""
1137
     local sp=""
1120
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1138
     test "$(__jat__sd_keyr phase)" == dummy || sp="  "
1121
     __jat__show \
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
 __jat__show_error() {
1143
 __jat__show_error() {