Up arrow navigation test failing but it works on my machine

I’m stuck on Stage #RH7.

I’ve implemented the up arrow navigation feature by using the ReadLine nuget package. It works fine locally but it’s failing the tests.

Here are my logs:

[tester::#RH7] Running tests for Stage #RH7 (History - Up-arrow navigation)
[tester::#RH7] Running ./your_program.sh
[your-program] $ echo grape mango
[your-program] grape mango
[tester::#RH7] ✓ Command executed successfully
[your-program] $ echo banana mango
[your-program] banana mango
[tester::#RH7] ✓ Command executed successfully
[your-program] $ invalid_orange_command
[your-program] invalid_orange_command: not found
[tester::#RH7] ✓ Received command not found message
[your-program] $ echo grape apple
[your-program] grape apple
[tester::#RH7] ✓ Command executed successfully
[tester::#RH7] Pressed "<UP ARROW>" (expecting to recall "echo grape apple")
[tester::#RH7] ✓ Prompt line matches "echo grape apple"
[tester::#RH7] Pressed "<UP ARROW>" (expecting to recall "invalid_orange_command")
[your-program] $ echo grape apple
[tester::#RH7] ^ Line does not match expected value.
[tester::#RH7] Expected: "$ invalid_orange_command"
[tester::#RH7] Received: "$ echo grape apple"
[tester::#RH7] Assertion failed.
[tester::#RH7] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

I’m using ReadLine to get the command:

string command = ReadLine.Read() ?? "";

and I’m adding every command to history afterward:

ReadLine.AddHistory(command);

Here it is running locally:

shell-challenge-up-navigation

1 Like

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

I am facing the same issue. @andy1li

@jm6271 @sandipndev Looks like you’ve got past this stage. Do you happen to remember what was wrong? Would love to see if we can improve the tester / instructions.

@andy1li I’ve moved on to a different stage, but I still haven’t figured this one out.

A post was split to a new topic: Up arrow navigation test failing

Hey @jm6271, sorry for the delayed response!

I believe the issue is caused by the readline library, which hasn’t been updated since 2018.

Other users have had success using an alternative library ReadLine.Ext. You might want to give that a try.

1 Like

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