v0.26.3 web viewer improvement
This commit is contained in:
1 parent
d745a128a2
commit
c00c076d9b
14 files changed
+159
-85
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package core
|
||||
|
||||
import "testing"
|
||||
|
||||
// A line's level is its first whole word, in any case, naming a level, not the
|
||||
// most severe one named; a wanted level skips the names of the others.
|
||||
func TestLevelIsTheFirstWordNamingOne(t *testing.T) {
|
||||
for _, c := range []struct {
|
||||
text, want, level string
|
||||
start, end int
|
||||
}{
|
||||
{"warning disk full", "", "WARN", 0, 7},
|
||||
{"DBG x", "", "DEBUG", 0, 3},
|
||||
{"2026-10-05 [Info] retry after error", "", "INFO", 12, 16},
|
||||
{`{"level":"fatal","msg":"x"}`, "", "ERROR", 10, 15},
|
||||
{"terror informal x_ERR", "", "", 0, 0},
|
||||
{"INFO then ERR", "ERROR", "ERROR", 10, 13},
|
||||
} {
|
||||
level, start, end := LevelWord(c.text, c.want)
|
||||
if level != c.level || start != c.start || end != c.end {
|
||||
t.Errorf("%q want %q: got %q [%d:%d], want %q [%d:%d]", c.text, c.want, level, start, end, c.level, c.start, c.end)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user