From 2acfa40ac128a5f271c20515b10adbd0403aba25 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 2 Mar 2017 14:34:08 +0100 Subject: tests: add column(1) table test Signed-off-by: Karel Zak --- tests/expected/column/table | 0 tests/expected/column/table-default | 6 +++++ tests/expected/column/table-input-separator | 6 +++++ tests/expected/column/table-output-separator | 6 +++++ tests/ts/column/files/table | 6 +++++ tests/ts/column/files/table-sep | 6 +++++ tests/ts/column/separator_table | 31 ---------------------- tests/ts/column/table | 39 ++++++++++++++++++++++++++++ 8 files changed, 69 insertions(+), 31 deletions(-) create mode 100644 tests/expected/column/table create mode 100644 tests/expected/column/table-default create mode 100644 tests/expected/column/table-input-separator create mode 100644 tests/expected/column/table-output-separator create mode 100644 tests/ts/column/files/table create mode 100644 tests/ts/column/files/table-sep delete mode 100755 tests/ts/column/separator_table create mode 100755 tests/ts/column/table diff --git a/tests/expected/column/table b/tests/expected/column/table new file mode 100644 index 000000000..e69de29bb diff --git a/tests/expected/column/table-default b/tests/expected/column/table-default new file mode 100644 index 000000000..5fc905dfe --- /dev/null +++ b/tests/expected/column/table-default @@ -0,0 +1,6 @@ +AAA BBBB C DDDD +A BBB CCCC DDD +AA BB CCC DD +AAAA B CC D +AA BB CC DD +AAAAA BBB CCC DDDD diff --git a/tests/expected/column/table-input-separator b/tests/expected/column/table-input-separator new file mode 100644 index 000000000..284f4ef79 --- /dev/null +++ b/tests/expected/column/table-input-separator @@ -0,0 +1,6 @@ +AAA BBBB C DDDD +A BBB CCCC DDD +AA BB DD +AAAA B CC D +AA CC DD +AAAAA BBB CCC DDDD diff --git a/tests/expected/column/table-output-separator b/tests/expected/column/table-output-separator new file mode 100644 index 000000000..c9199dbf4 --- /dev/null +++ b/tests/expected/column/table-output-separator @@ -0,0 +1,6 @@ +AAA |BBBB|C |DDDD +A |BBB |CCCC|DDD +AA |BB |CCC |DD +AAAA |B |CC |D +AA |BB |CC |DD +AAAAA|BBB |CCC |DDDD diff --git a/tests/ts/column/files/table b/tests/ts/column/files/table new file mode 100644 index 000000000..e051631f7 --- /dev/null +++ b/tests/ts/column/files/table @@ -0,0 +1,6 @@ +AAA BBBB C DDDD +A BBB CCCC DDD +AA BB CCC DD +AAAA B CC D +AA BB CC DD +AAAAA BBB CCC DDDD diff --git a/tests/ts/column/files/table-sep b/tests/ts/column/files/table-sep new file mode 100644 index 000000000..c56bac891 --- /dev/null +++ b/tests/ts/column/files/table-sep @@ -0,0 +1,6 @@ +AAA,BBBB,C,DDDD +A,BBB,CCCC,DDD +AA,BB,,DD +AAAA,B,CC,D +AA,,CC,DD +AAAAA,BBB,CCC,DDDD diff --git a/tests/ts/column/separator_table b/tests/ts/column/separator_table deleted file mode 100755 index 4ac910d8e..000000000 --- a/tests/ts/column/separator_table +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# -# Copyright (C) 2011 Sami Kerola -# -# 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="separator & table" - -. $TS_TOPDIR/functions.sh -ts_init "$*" - -ts_check_test_command "$TS_CMD_COLUMN" - -ts_cd "$TS_OUTDIR" - -$TS_CMD_COLUMN -s 2 -t $TS_SELF/files/fivecols >> $TS_OUTPUT 2>&1 - -ts_finalize - diff --git a/tests/ts/column/table b/tests/ts/column/table new file mode 100755 index 000000000..c977b96e2 --- /dev/null +++ b/tests/ts/column/table @@ -0,0 +1,39 @@ +#!/bin/bash + +# +# Copyright (C) 2011 Sami Kerola +# +# 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="table" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_COLUMN" +ts_cd "$TS_OUTDIR" + +ts_init_subtest "default" +$TS_CMD_COLUMN --table $TS_SELF/files/table >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "output-separator" +$TS_CMD_COLUMN --output-separator '|' --table $TS_SELF/files/table >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "input-separator" +$TS_CMD_COLUMN --separator ',' --table $TS_SELF/files/table-sep >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_finalize -- cgit v1.2.3-55-g7522