func (a *AutoComplete) Do(line rune, pos int) (newLine rune, length int) {
newLine, length = a.completer.Do(line, pos)
sort.Slice(newLine, func(i, j int) bool {
return string(newLine[i]) < string(newLine[j])
})
if len(newLine) == 0 {
fmt.Fprintf(os.Stdout, “\x07”)
} else if len(newLine) == 1 {
return newLine, length
} else {
if !a.tabPress {
a.tabPress = true
fmt.Fprintf(os.Stdout, “\x07”)
} else {
a.tabPress = false
strs := make(string, 0, len(newLine))
for _, s := range newLine {
strs = append(strs, strings.TrimSpace(string(s)))
}
fmt.Fprintf(os.Stdout, “%s\n”, “Wrong input”)
// fmt.Fprintf(os.Stdout, “%s\n”, strings.Join(strs, " "))
fmt.Fprintf(os.Stdout, “%s%s\n”, a.rl.Config.Prompt, string(line))
a.rl.Refresh()
}
}
return newLine, length
}
} this is my code and this is the debug for the outout: ✓ Received prompt ($ )
[tester::#WH6] Typed “xyz_”
[your-program] $ xyz_
[tester::#WH6] ✓ Prompt line matches “$ xyz_”
[tester::#WH6] Pressed “” (expecting bell to ring)
[tester::#WH6] Pressed “” (expecting autocomplete to “xyz_ant xyz_bee xyz_fox”)
[tester::#WH6] ✓ Received bell
[your-program] xyz_ant xyz_bee xyz_fox
[tester::#WH6] ✓ Prompt line matches “xyz_ant xyz_bee xyz_fox”
[tester::#WH6] Didn’t find expected line.
[tester::#WH6] Expected: “$ xyz_”
[tester::#WH6] Received: “” (no line received)
[tester::#WH6] Assertion failed.
[tester::#WH6] Test failed
If I removed the printing line wrong output, the error messages still the same. If I remove the print the correct message it still appear. It seems to me that somehow the tester on my machine is not reflecting the change I made
