mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-18 04:51:05 +01:00
refactored and un-go-criticed
This commit is contained in:
@@ -216,6 +216,7 @@ func (conf *Config) DetermineColormode() {
|
||||
// Return true if current terminal is interactive
|
||||
func isTerminal(f *os.File) bool {
|
||||
o, _ := f.Stat()
|
||||
|
||||
return (o.Mode() & os.ModeCharDevice) == os.ModeCharDevice
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,14 @@ func TestPrepareModeFlags(t *testing.T) {
|
||||
}
|
||||
|
||||
// FIXME: use a map for easier printing
|
||||
for _, tt := range tests {
|
||||
testname := fmt.Sprintf("PrepareModeFlags-expect-%d", tt.expect)
|
||||
for _, testdata := range tests {
|
||||
testname := fmt.Sprintf("PrepareModeFlags-expect-%d", testdata.expect)
|
||||
t.Run(testname, func(t *testing.T) {
|
||||
c := Config{}
|
||||
conf := Config{}
|
||||
|
||||
c.PrepareModeFlags(tt.flag)
|
||||
if c.OutputMode != tt.expect {
|
||||
t.Errorf("got: %d, expect: %d", c.OutputMode, tt.expect)
|
||||
conf.PrepareModeFlags(testdata.flag)
|
||||
if conf.OutputMode != testdata.expect {
|
||||
t.Errorf("got: %d, expect: %d", conf.OutputMode, testdata.expect)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user