package cmd import ( "testing" ) func TestRemoveLastModifiedComments(t *testing.T) { tests := []struct { name string input string expected string }{ { name: "removes last modified comment", input: "// Last modified: 2024-01-01\npackage main\n\nfunc main() {}", expected: "package main\n\nfunc main() {}", }, { name: "removes multiple last modified comments", input: "// Last modified: 2024-01-01\npackage main\n// Last modified by: user\nfunc main() {}", expected: "package main\nfunc main() {}", }, { name: "preserves code without last modified", input: "package main\n\nfunc main() {}", expected: "package main\n\nfunc main() {}", }, { name: "handles empty string", input: "", expected: "", }, { name: "preserves other comments", input: "// This is a regular comment\npackage main\n// Last modified: 2024\n// Another comment\nfunc main() {}", expected: "// This is a regular comment\npackage main\n// Another comment\nfunc main() {}", }, { name: "handles line with only last modified", input: "Last modified: 2024-01-01", expected: "", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { result := removeLastModifiedComments(tt.input) if result != tt.expected { t.Errorf("removeLastModifiedComments() = %q, want %q", result, tt.expected) } }) } }