all repos

clerk @ b36147319e95509014992fd3832247e82733d6c6

missing tooling for ledger/hledger
6 files changed, 31 insertions(+), 34 deletions(-)
tests: consistent golden.Read placement
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-08-16 18:20:34 +0300
Authored at: 2026-08-16 18:14:36 +0300
Change ID: votyukvqrwnyvpsxoszspwtzsvrllums
Parent: 05a3553
M internal/lsp/textdocument_completion_test.go
···
        27
        27
         

      
        28
        28
         func TestGolden_Completion(t *testing.T) {

      
        29
        29
         	for _, tt := range []string{"completion-contexts", "completion-journal", "completion-no-transactions"} {

      
        30
        
        -		ar := golden.Read(t, tt)

      
        31
        
        -

      
        32
        30
         		t.Run(tt, func(t *testing.T) {

      
        
        31
        +			ar := golden.Read(t, tt)

      
        33
        32
         			h := newTxtarHarness(t, ar)

      
        34
        33
         

      
        35
        34
         			var b strings.Builder

      
M internal/lsp/textdocument_definition_test.go
···
        32
        32
         

      
        33
        33
         func TestGolden_Definition(t *testing.T) {

      
        34
        34
         	for _, tt := range []string{"definition-journal", "definition-include"} {

      
        35
        
        -		ar := golden.Read(t, tt)

      
        36
        35
         		t.Run(tt, func(t *testing.T) {

      
        
        36
        +			ar := golden.Read(t, tt)

      
        37
        37
         			h := newTxtarHarness(t, ar)

      
        38
        38
         

      
        39
        39
         			var b strings.Builder

      
M internal/lsp/textdocument_hover_test.go
···
        63
        63
         

      
        64
        64
         func TestGolden_Hover(t *testing.T) {

      
        65
        65
         	for _, tt := range []string{"hover-journal", "hover-include"} {

      
        66
        
        -		ar := golden.Read(t, tt)

      
        67
        66
         		t.Run(tt, func(t *testing.T) {

      
        
        67
        +			ar := golden.Read(t, tt)

      
        68
        68
         			h := newTxtarHarness(t, ar)

      
        69
        69
         

      
        70
        70
         			var b strings.Builder

      
M internal/lsp/textdocument_references_test.go
···
        33
        33
         

      
        34
        34
         func TestGolden_References(t *testing.T) {

      
        35
        35
         	for _, tt := range []string{"references-journal", "references-include"} {

      
        36
        
        -		ar := golden.Read(t, tt)

      
        37
        36
         		t.Run(tt, func(t *testing.T) {

      
        
        37
        +			ar := golden.Read(t, tt)

      
        38
        38
         			h := newTxtarHarness(t, ar)

      
        39
        39
         

      
        40
        40
         			var b strings.Builder

      
M internal/lsp/textdocument_rename_test.go
···
        72
        72
         

      
        73
        73
         func TestGolden_Rename(t *testing.T) {

      
        74
        74
         	for _, tt := range []string{"rename-account", "rename-commodity", "rename-payee", "rename-tag"} {

      
        75
        
        -		ar := golden.Read(t, tt)

      
        76
        75
         		t.Run(tt, func(t *testing.T) {

      
        
        76
        +			ar := golden.Read(t, tt)

      
        77
        77
         			h := newTxtarHarness(t, ar)

      
        78
        78
         

      
        79
        79
         			newNames := strings.Split(strings.TrimRight(string(ar.Get("rename")), "\n"), "\n")

      
M internal/lsp/workspace_symbol_test.go
···
        66
        66
         

      
        67
        67
         func TestGolden_Symbols(t *testing.T) {

      
        68
        68
         	ar := golden.Read(t, "workspace-symbol")

      
        69
        
        -	t.Run("workspace-symbol", func(t *testing.T) {

      
        70
        
        -		h := newTxtarHarness(t, ar)

      
        
        69
        +	h := newTxtarHarness(t, ar)

      
        71
        70
         

      
        72
        
        -		// One query per line; a trailing blank line is the empty-query case.

      
        73
        
        -		queries := strings.Split(strings.TrimSuffix(string(ar.Get("queries")), "\n"), "\n")

      
        74
        
        -		var b strings.Builder

      
        75
        
        -		for _, q := range queries {

      
        76
        
        -			res, err := h.srv.Symbols(t.Context(), &protocol.WorkspaceSymbolParams{Query: q})

      
        77
        
        -			if err != nil {

      
        78
        
        -				t.Fatal(err)

      
        79
        
        -			}

      
        80
        
        -			if res == nil {

      
        81
        
        -				fmt.Fprintf(&b, "%q <none>\n", q)

      
        82
        
        -				continue

      
        83
        
        -			}

      
        84
        
        -			list, ok := res.(protocol.WorkspaceSymbolSlice)

      
        
        71
        +	// One query per line; a trailing blank line is the empty-query case.

      
        
        72
        +	queries := strings.Split(strings.TrimSuffix(string(ar.Get("queries")), "\n"), "\n")

      
        
        73
        +	var b strings.Builder

      
        
        74
        +	for _, q := range queries {

      
        
        75
        +		res, err := h.srv.Symbols(t.Context(), &protocol.WorkspaceSymbolParams{Query: q})

      
        
        76
        +		if err != nil {

      
        
        77
        +			t.Fatal(err)

      
        
        78
        +		}

      
        
        79
        +		if res == nil {

      
        
        80
        +			fmt.Fprintf(&b, "%q <none>\n", q)

      
        
        81
        +			continue

      
        
        82
        +		}

      
        
        83
        +		list, ok := res.(protocol.WorkspaceSymbolSlice)

      
        
        84
        +		if !ok {

      
        
        85
        +			t.Fatalf("Symbols returned %T, want WorkspaceSymbolSlice", res)

      
        
        86
        +		}

      
        
        87
        +		for _, sym := range list {

      
        
        88
        +			loc, ok := sym.Location.(*protocol.Location)

      
        85
        89
         			if !ok {

      
        86
        
        -				t.Fatalf("Symbols returned %T, want WorkspaceSymbolSlice", res)

      
        
        90
        +				t.Fatalf("Symbol %q location is %T, want *Location", sym.Name, sym.Location)

      
        87
        91
         			}

      
        88
        
        -			for _, sym := range list {

      
        89
        
        -				loc, ok := sym.Location.(*protocol.Location)

      
        90
        
        -				if !ok {

      
        91
        
        -					t.Fatalf("Symbol %q location is %T, want *Location", sym.Name, sym.Location)

      
        92
        
        -				}

      
        93
        
        -				r := loc.Range

      
        94
        
        -				fmt.Fprintf(&b, "%q %s %s %s %d:%d-%d:%d\n", q, symbolKindName(sym.Kind), sym.Name,

      
        95
        
        -					filepath.Base(loc.URI.Path()),

      
        96
        
        -					r.Start.Line, r.Start.Character, r.End.Line, r.End.Character)

      
        97
        
        -			}

      
        
        92
        +			r := loc.Range

      
        
        93
        +			fmt.Fprintf(&b, "%q %s %s %s %d:%d-%d:%d\n", q, symbolKindName(sym.Kind), sym.Name,

      
        
        94
        +				filepath.Base(loc.URI.Path()),

      
        
        95
        +				r.Start.Line, r.Start.Character, r.End.Line, r.End.Character)

      
        98
        96
         		}

      
        99
        
        -		golden.Assert(t, ar, b.String())

      
        100
        
        -	})

      
        
        97
        +	}

      
        
        98
        +	golden.Assert(t, ar, b.String())

      
        101
        99
         }

      
        102
        100
         

      
        103
        101
         func BenchmarkSymbols(b *testing.B) {