]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
column: add test for ansi escapes
authorJuarez Rudsatz <juarezr@gmail.com>
Mon, 5 Feb 2024 01:33:35 +0000 (22:33 -0300)
committerJuarez Rudsatz <juarezr@gmail.com>
Tue, 6 Feb 2024 17:08:22 +0000 (14:08 -0300)
tests/expected/column/ansiescape [new file with mode: 0644]
tests/ts/column/ansiescape [new file with mode: 0755]
tests/ts/column/files/ansiescape [new file with mode: 0644]

diff --git a/tests/expected/column/ansiescape b/tests/expected/column/ansiescape
new file mode 100644 (file)
index 0000000..bb2de8a
--- /dev/null
@@ -0,0 +1,3 @@
+A1234567890a   D123^[[1;48;5;3m456789^[[49m0d
+B1^[[48;5;1m23456789^[[49m0b   E12345^[[m67890e
+C12^[[48;5;3m3456789^[[49m0c   F^[]8;;http://x.com^[\LINK^[]8;;^[\f
diff --git a/tests/ts/column/ansiescape b/tests/ts/column/ansiescape
new file mode 100755 (executable)
index 0000000..46edd0b
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2024 Juarez Rudsatz <juarezr@gmail.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="ansiescape"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_COLUMN"
+
+ts_cd "$TS_OUTDIR"
+
+printf '%b' "$(cat $TS_SELF/files/ansiescape)" | $TS_CMD_COLUMN -c 32 | cat -v >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+ts_finalize
diff --git a/tests/ts/column/files/ansiescape b/tests/ts/column/files/ansiescape
new file mode 100644 (file)
index 0000000..4ca85d4
--- /dev/null
@@ -0,0 +1,6 @@
+A1234567890a
+B1\033[48;5;1m23456789\033[49m0b
+C12\033[48;5;3m3456789\033[49m0c
+D123\033[1;48;5;3m456789\033[49m0d
+E12345\e[m67890e
+F\e]8;;http://x.com\e\\LINK\e]8;;\e\\f