I implemented a solution for a previous level, which works but doesn’t work for my current level. I need to edit the previous level code, but i can’t anywhere to do so.
Hi @ukpagrace, you can use our CLI to tests against previous stages by running:
codecrafters test --previous
Hey @andy1li, I want to edit/change the code of previous/completed level
Could you please clarify what you mean by “the code of the previous/completed level”?
okay, i am working on the build you own shell and right now i am in the cd(change directory) level, which tests for the pwd after changing directory. but the Implementation i did for the pwd level being the previous level is messing with the tests and i need to change the code.
All your code is in your repository/folder, so you can modify any part directly as needed.
Feel free to provide more details if I’ve misunderstood your concern.
I want to modify a submitted code that has been marked as completed. I modified my code, but code crafters is using the previous code i submitted for the completed level, in the current level i am at.
for example
this is the code being executed, and the test failing in the cd level
[tester::#RA6] > pwd
[your-program] /app
[tester::#RA6] Expected: "/tmp/strawberry/strawberry/strawberry"
[tester::#RA6] Received: "/app"
[your-program] $
in the previous level “pwd”
This the code
case ("pwd"):
String userDirectory = Paths.get("").toAbsolutePath().toString();
System.out.println(userDirectory);
break;
when the test kept failing despite changing the pwd implementation i figured it was not reflecting so i changed the implementation on pwd to see if i would change
case("pwd"):
System.out.println("hello");
which didn’t reflect, meaning code crafters is using the code i already submitted.
because this is still what is showing
[tester::#RA6] > pwd
[your-program] /app
[tester::#RA6] Expected: "/tmp/strawberry/strawberry/strawberry"
[tester::#RA6] Received: "/app"
[your-program] $
We always run the latest version of your code, so the issue is likely caused by something else.
Could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.
So I added two logs A and B:
while(true){
...
if(getPath(command) != null){
if(!command.equals("cd")){
System.out.println("🅰️");
}
...
}else{
if(!command.equals("cd")){
System.out.println("🅱️");
}
switch(command){...
Not sure what getPath
is supposed to do, but you might to want to look closer into why A was printed out:
Yes, Thank you
Thanks a whole lot, will look into this.
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.