Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / lint / lintutil / util_test.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/lint/lintutil/util_test.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/lint/lintutil/util_test.go
new file mode 100644 (file)
index 0000000..b348ba1
--- /dev/null
@@ -0,0 +1,45 @@
+package lintutil
+
+import (
+       "go/token"
+       "testing"
+)
+
+func TestParsePos(t *testing.T) {
+       var tests = []struct {
+               in  string
+               out token.Position
+       }{
+               {
+                       "/tmp/gopackages280076669/go-build/net/cgo_linux.cgo1.go:1",
+                       token.Position{
+                               Filename: "/tmp/gopackages280076669/go-build/net/cgo_linux.cgo1.go",
+                               Line:     1,
+                               Column:   0,
+                       },
+               },
+               {
+                       "/tmp/gopackages280076669/go-build/net/cgo_linux.cgo1.go:1:",
+                       token.Position{
+                               Filename: "/tmp/gopackages280076669/go-build/net/cgo_linux.cgo1.go",
+                               Line:     1,
+                               Column:   0,
+                       },
+               },
+               {
+                       "/tmp/gopackages280076669/go-build/net/cgo_linux.cgo1.go:23:43",
+                       token.Position{
+                               Filename: "/tmp/gopackages280076669/go-build/net/cgo_linux.cgo1.go",
+                               Line:     23,
+                               Column:   43,
+                       },
+               },
+       }
+
+       for _, tt := range tests {
+               res := parsePos(tt.in)
+               if res != tt.out {
+                       t.Errorf("failed to parse %q correctly", tt.in)
+               }
+       }
+}