commit 87890bc26c1c6958bd64bb9d46fbc29ba6a92d95 from: Omar Polo date: Thu Mar 28 08:28:36 2024 UTC http_notification regress: prettify the json long lines are not manegeable. split the json over multiple lines, then use ed to join everything back in a single one. commit - 9e88f9d9a5df5ab1462296b2ba998f33a1c56ea4 commit + 87890bc26c1c6958bd64bb9d46fbc29ba6a92d95 blob - 0bdee55c775294875ff9724aa4f7744fe0c7b43b blob + 6892df7536c1a19134db4827c42f870d903c65a7 --- regress/gotd/http_notification.sh +++ regress/gotd/http_notification.sh @@ -56,8 +56,21 @@ test_file_changed() { d=`date -u -r $author_time +"%a %b %e %X %Y UTC"` - cat <<-EOF > $testroot/stdout.expected - {"notifications":[{"short":false,"id":"$commit_id","author":"$GOT_AUTHOR","date":"$d","message":"make changes\n","diffstat":{},"changes":{}}]} + touch "$testroot/stdout.expected" + ed -s "$testroot/stdout.expected" <<-EOF + a + {"notifications":[{ + "short":false, + "id":"$commit_id", + "author":"$GOT_AUTHOR", + "date":"$d", + "message":"make changes\n", + "diffstat":{}, + "changes":{} + }]} + . + ,j + w EOF cmp -s $testroot/stdout.expected $testroot/stdout @@ -118,11 +131,27 @@ test_many_commits_not_summarized() { s=`pop_idx $i "$@"` commit_id=$(echo $s | cut -d' ' -f1) commit_time=$(echo $s | sed -e "s/^$commit_id //g") - printf '%s{"short":false,"id":"%s","author":"%s","date":"%s","message":"%s","diffstat":{},"changes":{}}' \ - "$comma" "$commit_id" "$GOT_AUTHOR" "$commit_time" "make changes\n" - comma="," + + echo "$comma" + comma=',' + + cat <<-EOF + { + "short":false, + "id":"$commit_id", + "author":"$GOT_AUTHOR", + "date":"$commit_time", + "message":"make changes\n", + "diffstat":{}, + "changes":{} + } + EOF done >> $testroot/stdout.expected echo "]}" >> $testroot/stdout.expected + ed -s "$testroot/stdout.expected" <<-EOF + ,j + w + EOF cmp -s $testroot/stdout.expected $testroot/stdout ret=$? @@ -183,12 +212,25 @@ test_many_commits_summarized() { s=`pop_idx $i "$@"` commit_id=$(echo $s | cut -d' ' -f1) commit_time=$(echo $s | sed -e "s/^$commit_id //g") - printf '%s{"short":true,"id":"%s","author":"%s","date":"%s","message":"%s"}' \ - "$comma" "$commit_id" "$GOT_AUTHOR_8" \ - "$commit_time" "make changes" - comma="," + + echo "$comma" + comma=',' + + cat <<-EOF + { + "short":true, + "id":"$commit_id", + "author":"$GOT_AUTHOR_8", + "date":"$commit_time", + "message":"make changes" + } + EOF done >> $testroot/stdout.expected echo "]}" >> $testroot/stdout.expected + ed -s "$testroot/stdout.expected" <<-EOF + ,j + w + EOF cmp -s $testroot/stdout.expected $testroot/stdout ret=$?