Testing seems cache and does not update with the code

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

Hey @Binh0723, could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.

1 Like

GitHub - Binh0723/Binh0723-codecrafters-shell-go here is the link

Hey @Binh0723, your shell should suppress autocomplete and ring the bell on the first Tab press, like this:

Let me know you’d like any further clarification!

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.