mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 04:30:56 +01:00
fixed transpose error message if count is incorrect
This commit is contained in:
@@ -104,6 +104,9 @@ type Config struct {
|
|||||||
// used for field filtering
|
// used for field filtering
|
||||||
Rawfilters []string
|
Rawfilters []string
|
||||||
Filters map[string]*regexp.Regexp
|
Filters map[string]*regexp.Regexp
|
||||||
|
|
||||||
|
// -r <file>
|
||||||
|
InputFile string
|
||||||
}
|
}
|
||||||
|
|
||||||
// maps outputmode short flags to output mode, ie. -O => -o orgtbl
|
// maps outputmode short flags to output mode, ie. -O => -o orgtbl
|
||||||
@@ -297,7 +300,7 @@ func (conf *Config) PrepareFilters() error {
|
|||||||
func (conf *Config) PrepareTransposers() error {
|
func (conf *Config) PrepareTransposers() error {
|
||||||
if len(conf.Transposers) != len(conf.UseTransposeColumns) {
|
if len(conf.Transposers) != len(conf.UseTransposeColumns) {
|
||||||
return fmt.Errorf("the number of transposers needs to correspond to the number of transpose columns: %d != %d",
|
return fmt.Errorf("the number of transposers needs to correspond to the number of transpose columns: %d != %d",
|
||||||
len(conf.Transposers), len(strings.Split(conf.TransposeColumns, ",")))
|
len(conf.Transposers), len(conf.UseTransposeColumns))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, transposer := range conf.Transposers {
|
for _, transposer := range conf.Transposers {
|
||||||
|
|||||||
45
t/test.sh
45
t/test.sh
@@ -1,45 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# simple commandline unit test script
|
|
||||||
|
|
||||||
t="../tablizer"
|
|
||||||
fail=0
|
|
||||||
|
|
||||||
ex() {
|
|
||||||
# execute a test, report+exit on error, stay silent otherwise
|
|
||||||
log="/tmp/test-tablizer.$$.log"
|
|
||||||
name=$1
|
|
||||||
shift
|
|
||||||
|
|
||||||
echo -n "TEST $name "
|
|
||||||
|
|
||||||
$* > $log 2>&1
|
|
||||||
|
|
||||||
if test $? -ne 0; then
|
|
||||||
echo "failed, see $log"
|
|
||||||
fail=1
|
|
||||||
else
|
|
||||||
echo "ok"
|
|
||||||
rm -f $log
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# only use files in test dir
|
|
||||||
cd $(dirname $0)
|
|
||||||
|
|
||||||
echo "Executing commandline tests ..."
|
|
||||||
|
|
||||||
# io pattern tests
|
|
||||||
ex io-pattern-and-file $t bk7 testtable
|
|
||||||
cat testtable | ex io-pattern-and-stdin $t bk7
|
|
||||||
cat testtable | ex io-pattern-and-stdin-dash $t bk7 -
|
|
||||||
|
|
||||||
# same w/o pattern
|
|
||||||
ex io-just-file $t testtable
|
|
||||||
cat testtable | ex io-just-stdin $t
|
|
||||||
cat testtable | ex io-just-stdin-dash $t -
|
|
||||||
|
|
||||||
if test $fail -ne 0; then
|
|
||||||
echo "!!! Some tests failed !!!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user