Closed miguelraz closed 3 months ago
Ah. I forgot about Windows users.
It's a bit sad we have to ignore the tests in the Linux CI. Perhaps there are commands we could use that work for both kinds of OS?
I couldn't find an easy shared command (with shared flags!) between Powershell and Unix.
Confusingly, Powershell does run ls
, but won't spawn a command named ls
.
Alternatively, we can branch on the OS and write a
Command::new("Get-Child") // this is an `ls- la` in Windows
.args(&["-Force"])
.spawn()
.expect("Get-Child command failed to start");
but it adds a bit more noise to the example that I think is warranted.
How about if we leave the code as-is, but rename the function from main
to example
. Then the code will compile (and it should compile fine on windows too), but running the test won't actually execute the code. But if we want to run the example in the playground, we click "RUN" and rename the function from example
to main
.
This will also stop a test run from creating files like lunch.txt
.
That's solid. Will change it in a bit.
Running
mdbook test
without these changes fails and is very noisy. We should just toggle theignore
feature in those blocks.