github.com/v2fly/tools@v0.100.0/internal/lsp/cmd/test/folding_range.go (about)

     1  // Copyright 2019 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package cmdtest
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/v2fly/tools/internal/span"
    11  )
    12  
    13  func (r *runner) FoldingRanges(t *testing.T, spn span.Span) {
    14  	goldenTag := "foldingRange-cmd"
    15  	uri := spn.URI()
    16  	filename := uri.Filename()
    17  	got, _ := r.NormalizeGoplsCmd(t, "folding_ranges", filename)
    18  	expect := string(r.data.Golden(goldenTag, filename, func() ([]byte, error) {
    19  		return []byte(got), nil
    20  	}))
    21  
    22  	if expect != got {
    23  		t.Errorf("folding_ranges failed failed for %s expected:\n%s\ngot:\n%s", filename, expect, got)
    24  	}
    25  }