diff options
author | Bryan Drewery <bryan@shatow.net> | 2022-09-09 23:37:46 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2022-11-05 18:47:57 +0300 |
commit | daf8d54a1af43111aa9fd02c7462533352e0d823 (patch) | |
tree | c73750c2c9993ec11b596387162443f1b3e86844 | |
parent | 6c12bc766ce8cddbd4f732f0df5592e5c596b0e0 (diff) |
display test: reindent
-rw-r--r-- | test/display.sh | 105 |
1 files changed, 55 insertions, 50 deletions
diff --git a/test/display.sh b/test/display.sh index 82d4b671..17d1eab1 100644 --- a/test/display.sh +++ b/test/display.sh @@ -22,54 +22,59 @@ $(cat -vet "${expected}")" } alias assert_file='_assert_file "$0:$LINENO"' -display_setup "%%-%ds %%-%ds" "-k2,2V -k1,1d" -display_add "Name" "Release" -display_add "blah" "11.2-RELEASE-p1" -display_add "blah" "10.0-RELEASE" -display_add "blah" "10.2-RELEASE" -display_add "blah" "10.2-RELEASE-p10" -display_add "blah2" "10.2-RELEASE-p1" -display_add "blah" "10.2-RELEASE-p1" -display_add "blah" "9.3-RELEASE-p10" -display_add "blah" "9.3-RELEASE-p1" -display_add "blah" "8.2-RELEASE-p1" -outfile=$(mktemp -t outfile) -display_output > "${outfile}" -expected=$(mktemp -t expected) -cat > "${expected}" <<-EOF -Name Release -blah 8.2-RELEASE-p1 -blah 9.3-RELEASE-p1 -blah 9.3-RELEASE-p10 -blah 10.0-RELEASE -blah 10.2-RELEASE -blah 10.2-RELEASE-p1 -blah2 10.2-RELEASE-p1 -blah 10.2-RELEASE-p10 -blah 11.2-RELEASE-p1 -EOF -assert_file "${expected}" "${outfile}" +{ + display_setup "%%-%ds %%-%ds" "-k2,2V -k1,1d" + display_add "Name" "Release" + display_add "blah" "11.2-RELEASE-p1" + display_add "blah" "10.0-RELEASE" + display_add "blah" "10.2-RELEASE" + display_add "blah" "10.2-RELEASE-p10" + display_add "blah2" "10.2-RELEASE-p1" + display_add "blah" "10.2-RELEASE-p1" + display_add "blah" "9.3-RELEASE-p10" + display_add "blah" "9.3-RELEASE-p1" + display_add "blah" "8.2-RELEASE-p1" + outfile=$(mktemp -t outfile) + display_output > "${outfile}" + expected=$(mktemp -t expected) + cat > "${expected}" <<-EOF + Name Release + blah 8.2-RELEASE-p1 + blah 9.3-RELEASE-p1 + blah 9.3-RELEASE-p10 + blah 10.0-RELEASE + blah 10.2-RELEASE + blah 10.2-RELEASE-p1 + blah2 10.2-RELEASE-p1 + blah 10.2-RELEASE-p10 + blah 11.2-RELEASE-p1 + EOF + assert_file "${expected}" "${outfile}" +} -display_setup "%%%ds %%-%ds %%-%ds" "-k1,1n" -display_add "JID" "IP Address" "vnet_num" -display_add "189" "" 0 -display_add "188" "" 0 -display_add "187" "" 0 -display_add "150" "10.2.1.4,127.0.1.4" 0 -display_add "99" "10.2.1.3,127.0.1.3" 0 -display_add "87" "192.168.2.38" 0 -display_add "85" "192.168.2.52" 0 -outfile=$(mktemp -t outfile) -display_output > "${outfile}" -expected=$(mktemp -t expected) -cat > "${expected}" <<-EOF -JID IP Address vnet_num - 85 192.168.2.52 0 - 87 192.168.2.38 0 - 99 10.2.1.3,127.0.1.3 0 -150 10.2.1.4,127.0.1.4 0 -187 0 -188 0 -189 0 -EOF -assert_file "${expected}" "${outfile}" +{ + # Test a case that was totally wrong due to quoting the first field + display_setup "%%%ds %%-%ds %%-%ds" "-k1,1n" + display_add "JID" "IP Address" "vnet_num" + display_add "189" "" 0 + display_add "188" "" 0 + display_add "187" "" 0 + display_add "150" "10.2.1.4,127.0.1.4" 0 + display_add "99" "10.2.1.3,127.0.1.3" 0 + display_add "87" "192.168.2.38" 0 + display_add "85" "192.168.2.52" 0 + outfile=$(mktemp -t outfile) + display_output > "${outfile}" + expected=$(mktemp -t expected) + cat > "${expected}" <<-EOF + JID IP Address vnet_num + 85 192.168.2.52 0 + 87 192.168.2.38 0 + 99 10.2.1.3,127.0.1.3 0 + 150 10.2.1.4,127.0.1.4 0 + 187 0 + 188 0 + 189 0 + EOF + assert_file "${expected}" "${outfile}" +} |