Update nodeloc_vps_autotest_yabs.sh

This commit is contained in:
Jensfrank 2024-06-28 20:22:09 +08:00 committed by GitHub
parent 5b7a9e2e7a
commit 1680e7b053
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,12 +102,17 @@ declare -a test_results
# 在每个命令执行后保存结果 # 在每个命令执行后保存结果
run_and_capture() { run_and_capture() {
local command_output local command_output=$(eval "$1" 2>&1)
command_output=$(eval "$1" 2>&1)
test_results+=("$command_output") test_results+=("$command_output")
echo "$command_output" echo "$command_output"
} }
# 去除Yabs板块ANSI转义码
yabs_process_output() {
local input="$1"
echo "$input" | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g'
}
# 运行所有测试 # 运行所有测试
run_all_tests() { run_all_tests() {
echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}" echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}"
@ -123,10 +128,14 @@ run_all_tests() {
# 格式化结果为 Markdown # 格式化结果为 Markdown
format_results() { format_results() {
# 处理yabs测试结果
local processed_yabs_result=$(response_yabs_output "$yabs_result")
result="[tabs] result="[tabs]
[tab=\"YABS\"] [tab=\"YABS\"]
\`\`\` \`\`\`
$yabs_result $processed_yabs_result
\`\`\` \`\`\`
[/tab] [/tab]
[/tabs]" [/tabs]"