MCPcopy Create free account
hub / github.com/abiosoft/mold / TestPos

Function TestPos

process_test.go:8–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestPos(t *testing.T) {
9 source := `<html>
10
11<head>
12 <title>Test</title>
13</head>
14
15<body>
16 <p>Hello world</p>
17</body>
18
19</html>
20`
21 tests := []struct {
22 body string
23 pos int
24 expectedLine int
25 expectedCol int
26 }{
27 {
28 body: "",
29 pos: 0,
30 expectedLine: 1,
31 expectedCol: 1,
32 },
33 {
34 body: source,
35 pos: 0,
36 expectedLine: 1,
37 expectedCol: 1,
38 },
39 {
40 body: source,
41 pos: 5,
42 expectedLine: 1,
43 expectedCol: 6,
44 },
45 {
46 body: source,
47 pos: 20,
48 expectedLine: 4,
49 expectedCol: 6,
50 },
51 {
52 body: source,
53 pos: 30,
54 expectedLine: 4,
55 expectedCol: 16,
56 },
57 {
58 body: source,
59 pos: 50,
60 expectedLine: 7,
61 expectedCol: 3,
62 },
63 }
64
65 for i, tt := range tests {

Callers

nothing calls this directly

Calls 1

posFunction · 0.85

Tested by

no test coverage detected