exercism / exercism

Crowd-sourced code mentorship. Practice having thoughtful conversations about code.
https://exercism.org
7.37k stars 1.04k forks source link

Can't pass test in the IDE but passing on exercism platform #6256

Open R0bertDenir0 opened 2 years ago

R0bertDenir0 commented 2 years ago

Hello, I'm currently doing the Golang path . I did the lasagna exercise, and when I'm running a go test command it's not working, but when I submit my iteration on exercism it's passing the tests. Also Golang works with a main function and a main package, all the exercises are composed without main file, so you can't run a go run command on your code, is it normal? Thank you

github-actions[bot] commented 2 years ago

Hi and welcome to Exercism! :wave:

Thanks for opening an issue :slightly_smiling_face:

kotp commented 2 years ago

The exercises on Ruby are usually written in the view of writing "library" style solutions. We are not really meant to have a main in general to run interactively.

I would suppose that it is something that is (mis)configured on your system, that would cause code that is written that will pass on the platform, but not on your system.

Without seeing the error messages that you see, I would only be guessing as to what the problem might be locally.

R0bertDenir0 commented 2 years ago

@kotp , here is the error message I have in my terminal when i launch the test

command-line-arguments [command-line-arguments.test]
./lasagna_test.go:21:14: undefined: OvenTime
./lasagna_test.go:39:14: undefined: RemainingOvenTime
./lasagna_test.go:63:14: undefined: PreparationTime
./lasagna_test.go:88:14: undefined: ElapsedTime
FAIL    command-line-arguments [build failed]
FAIL

it's looking like normal return when a test fail like other programs outside of exercism, but it's passing on the platform...

kotp commented 2 years ago

@exercism/go Any ideas?

What does the code look like for when someone that maintains the Go track looks at this?

kotp commented 2 years ago

Also, while you are on the go track, and have asked for mentoring, you can ask there as well.

andrerfcsantos commented 2 years ago

@R0bertDenir0 Can you post your solution please? Along with the solution, can you also post the files you have locally (ls output should suffice) and the contents for the test file too?

What you describe seems that can be a mismatch between your local files and the ones exercism knows about. Did you update the exercise recently? If so, did you also re-download it? Are the content of the test files you see locally the same as what you see on the online editor?

Also Golang works with a main function and a main package, all the exercises are composed without main file, so you can't run a go run command on your code, is it normal?

Yes, this is intended. You can see each exercise as building a mini library, and the best way to run library code is via tests. That way the code is tested and there's no need to create a dummy main program that just to perform some calls to the library code when in reality we just want to test it.

AndresCampuzano commented 8 months ago

@kotp , here is the error message I have in my terminal when i launch the test

command-line-arguments [command-line-arguments.test]
./lasagna_test.go:21:14: undefined: OvenTime
./lasagna_test.go:39:14: undefined: RemainingOvenTime
./lasagna_test.go:63:14: undefined: PreparationTime
./lasagna_test.go:88:14: undefined: ElapsedTime
FAIL    command-line-arguments [build failed]
FAIL

it's looking like normal return when a test fail like other programs outside of exercism, but it's passing on the platform...

Actually I'm getting the same issue

SleeplessByte commented 8 months ago

@AndresCampuzano Can you post your solution please? Along with the solution, can you also post the files you have locally (ls output should suffice) and the contents for the test file too?