MCPcopy
hub / github.com/pelletier/go-toml / TestDecodeError

Function TestDecodeError

errors_test.go:15–187  ·  view source on GitHub ↗

nolint:funlen

(t *testing.T)

Source from the content-addressed store, hash-verified

13
14//nolint:funlen
15func TestDecodeError(t *testing.T) {
16 examples := []struct {
17 desc string
18 doc [3]string
19 msg string
20 expected string
21 }{
22 {
23 desc: "no context",
24 doc: [3]string{"", "morning", ""},
25 msg: "this is wrong",
26 expected: `
271| morning
28 | ~~~~~~~ this is wrong`,
29 },
30 {
31 desc: "one line",
32 doc: [3]string{"good ", "morning", " everyone"},
33 msg: "this is wrong",
34 expected: `
351| good morning everyone
36 | ~~~~~~~ this is wrong`,
37 },
38 {
39 desc: "exactly 3 lines",
40 doc: [3]string{`line1
41line2
42line3
43before `, "highlighted", ` after
44post line 1
45post line 2
46post line 3`},
47 msg: "this is wrong",
48 expected: `
491| line1
502| line2
513| line3
524| before highlighted after
53 | ~~~~~~~~~~~ this is wrong
545| post line 1
556| post line 2
567| post line 3`,
57 },
58 {
59 desc: "more than 3 lines",
60 doc: [3]string{`should not be seen1
61should not be seen2
62line1
63line2
64line3
65before `, "highlighted", ` after
66post line 1
67post line 2
68post line 3
69should not be seen3
70should not be seen4`},
71 msg: "this is wrong",
72 expected: `

Callers

nothing calls this directly

Calls 3

StringMethod · 0.95
EqualFunction · 0.92
wrapDecodeErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…