From 9f72fd46dbb370269852aaecd3198ef64d9f4883 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Sun, 4 Feb 2024 22:33:35 -0300 Subject: [PATCH] column: add test for ansi escapes --- tests/expected/column/ansiescape | 3 +++ tests/ts/column/ansiescape | 30 ++++++++++++++++++++++++++++++ tests/ts/column/files/ansiescape | 6 ++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/expected/column/ansiescape create mode 100755 tests/ts/column/ansiescape create mode 100644 tests/ts/column/files/ansiescape diff --git a/tests/expected/column/ansiescape b/tests/expected/column/ansiescape new file mode 100644 index 0000000000..bb2de8a0e0 --- /dev/null +++ b/tests/expected/column/ansiescape @@ -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 index 0000000000..46edd0bb1e --- /dev/null +++ b/tests/ts/column/ansiescape @@ -0,0 +1,30 @@ +#!/bin/bash + +# +# Copyright (C) 2024 Juarez Rudsatz +# +# 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 index 0000000000..4ca85d46d6 --- /dev/null +++ b/tests/ts/column/files/ansiescape @@ -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 -- 2.47.3