MCPcopy Create free account
hub / github.com/vale-cli/vale / TestFileToValueLineContinuationFromIssue1018

Function TestFileToValueLineContinuationFromIssue1018

internal/core/view_test.go:105–133  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestFileToValueLineContinuationFromIssue1018(t *testing.T) {
106 // Reproduces the original issue #1018 report: a double-quoted scalar
107 // using `\<newline>` line continuation. Before this fix, vale could
108 // not locate "Line 1 Line 2" in the source and erred with E100.
109 f := &File{
110 RealExt: ".yaml",
111 Content: "openapi: 3.0.1\ninfo:\n description: \"Line 1\\\n \\ Line 2\"\n",
112 }
113 value, scalars, err := fileToValue(f)
114 if err != nil {
115 t.Fatalf("fileToValue: %v", err)
116 }
117
118 got, err := selectStrings(value, "info.description")
119 if err != nil {
120 t.Fatalf("selectStrings: %v", err)
121 }
122 if len(got) != 1 || got[0] != "Line 1 Line 2" {
123 t.Fatalf("selectStrings = %v, want [\"Line 1 Line 2\"]", got)
124 }
125
126 r := newScalarResolver(scalars)
127 // Walk past the openapi version scalar first.
128 r.locate("3.0.1")
129 line, col := r.locate("Line 1 Line 2")
130 if line != 3 || col != 17 {
131 t.Errorf("description position = (%d,%d), want (3,17)", line, col)
132 }
133}

Callers

nothing calls this directly

Calls 4

fileToValueFunction · 0.85
selectStringsFunction · 0.85
newScalarResolverFunction · 0.85
locateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…