Something went wrong. Try again.
A code review TUI that tries to reduce how many red and green squiggles you have to squint at
diff-viewer code-review llm
Something went wrong. Try again.
Go
12345678910111213141516171819202122232425262728293031323334353637383940package meat
import "testing"
func TestPythonCodeWithoutStringsRetainsStructure(t *testing.T) { tests := []struct { name string text string want string }{ {name: "quoted values", text: `call("value", 'other')`, want: "call(, )"}, {name: "escaped quote", text: `call("value\"still quoted")`, want: "call()"}, {name: "comment", text: `call() # ignored`, want: "call() "}, {name: "triple quote", text: `call() '''docstring`, want: "call() "}, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { if got := pythonCodeWithoutStrings(test.text); got != test.want { t.Fatalf("pythonCodeWithoutStrings(%q) = %q, want %q", test.text, got, test.want) } }) }}
func TestTrimPythonCodeIgnoresHashesInStrings(t *testing.T) { tests := []struct { text string want string }{ {text: `value = "#" # comment`, want: `value = "#"`}, {text: `value = 'it\'s #1' # comment`, want: `value = 'it\'s #1'`}, {text: `value = 1`, want: `value = 1`}, } for _, test := range tests { if got := trimPythonCode(test.text); got != test.want { t.Errorf("trimPythonCode(%q) = %q, want %q", test.text, got, test.want) } }}