- Issue #4: currently there is no official release yet so we cant download from installer - I added an installer debugger here to test (f091dbf13bdf109b631951e2558651f560ca8b84) - Issue #5: my another library [fuzzy](https://github.com/versenilvis/fuzzy/) has a logic bug so it causes crash, fix d479c6cb4d8453e50366c9839daaabb45a98a2df - Other: - remove unneeded comments (edd9d05fdd16e682b6b416913e2fa9c3f6599956) - Add some tests - Fix reload crash (3a76e78e655fd8daafb635ec0937667325f75ee4) - New optimized build command (56a4a815f836271b861f32795d2df3b25a3dffc0)
31 lines
607 B
Go
31 lines
607 B
Go
package tests
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/versenilvis/iris/root"
|
|
)
|
|
|
|
func TestMergeResults(t *testing.T) {
|
|
|
|
t.Run("Dedup exact match", func(t *testing.T) {
|
|
// Mock history items that might conflict with specs
|
|
res := root.MergeResults("git", "spec")
|
|
seen := make(map[string]bool)
|
|
for _, r := range res {
|
|
if seen[r.Cmd] {
|
|
t.Errorf("Duplicate suggestion found: %q", r.Cmd)
|
|
}
|
|
seen[r.Cmd] = true
|
|
}
|
|
})
|
|
|
|
|
|
t.Run("Limit 100", func(t *testing.T) {
|
|
res := root.MergeResults("a", "history")
|
|
if len(res) > 100 {
|
|
t.Errorf("Expected max 100 suggestions, got %d", len(res))
|
|
}
|
|
})
|
|
}
|