package main import ( "testing" ) // Compare identical TOC strings returns false for breaking changes func TestHasBreakingChangesWithIdenticalTOCs(t *testing.T) { addon := &Addon{} toc := `## Interface: 70300 ## Title: Channeler ## Version: 1.6.0 ## Notes: Automatically sets up chat channels ## Author: Cyka #core Channeler.lua` result := addon.HasBreakingChanges(toc, toc) if result { t.Errorf("Expected HasBreakingChanges to return false for identical TOCs, got true") } } // Compare empty TOC strings returns false func TestHasBreakingChangesWithEmptyTOCs(t *testing.T) { addon := &Addon{} result := addon.HasBreakingChanges("", "") if result { t.Errorf("Expected HasBreakingChanges to return false for empty TOCs, got true") } } // Compare TOC strings with different content returns true for breaking changes func TestCompareTocStringsDifferentContent(t *testing.T) { addon := &Addon{} lhsToc := "## Interface: 70300\n## Title: Channeler\nChanneler.lua" rhsToc := "## Interface: 70300\n## Title: Channeler\nDifferentFile.lua" result := addon.HasBreakingChanges(lhsToc, rhsToc) if !result { t.Errorf("Expected breaking changes, but got none") } } // Compare TOC strings with different content returns true for breaking changes func TestCompareTocStringsNewFile(t *testing.T) { addon := &Addon{} lhsToc := "## Interface: 70300\n## Title: Channeler\nChanneler.lua" rhsToc := "## Interface: 70300\n## Title: Channeler\nChanneler.lua\nNewFile.lua" result := addon.HasBreakingChanges(lhsToc, rhsToc) if !result { t.Errorf("Expected breaking changes, but got none") } } // Compare TOC strings with same content but different whitespace returns false func TestCompareTocStringsSameContentDifferentWhitespace(t *testing.T) { addon := &Addon{} lhsToc := "## Interface: 70300\n## Title: Channeler\nChanneler.lua" rhsToc := "## Interface: 70300 \n## Title: Channeler \nChanneler.lua" result := addon.HasBreakingChanges(lhsToc, rhsToc) if result { t.Errorf("Expected no breaking changes, but got some") } } // Compare TOC strings with matching header lines (##) returns false func TestCompareTocStringsMatchingHeaderLines(t *testing.T) { addon := &Addon{} lhsToc := "## Interface: 70300\n## Title: Channeler\n## Version: 1.6.0" rhsToc := "## Interface: 70300\n## Title: Channeler\n## Version: 1.6.0" result := addon.HasBreakingChanges(lhsToc, rhsToc) if result { t.Errorf("Expected no breaking changes, but got some") } }