01mf02 / jaq

A jq clone focussed on correctness, speed, and simplicity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cargo test fails for golden

nouritsu opened this issue · comments

Running cargo test in jaq/ always fails at tests/golden.rs.

Replicate -

  • Clone repository
  • CD into directory
  • Run cargo test

Strange. I do not see this problem. What is your output? Mine is:

jaq$ cd jaq
jaq/jaq$ cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.06s
     Running unittests src/main.rs (jaq/target/debug/deps/jaq-b68310f4a0d4cb2a)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/golden.rs (jaq/target/debug/deps/golden-f4b60d016a194ebe)

running 8 tests
test compact ... ok
test arg ... ok
test inputs ... ok
test null_input ... ok
test one ... ok
test raw_input ... ok
test sparse ... ok
test raw_input_slurp ... ok

test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
PS C:\code-projects\jaq> cargo test
    Blocking waiting for file lock on build directory
    Finished test [unoptimized + debuginfo] target(s) in 2.46s
     Running unittests src\main.rs (target\debug\deps\jaq-3b6369058bce545e.exe)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests\golden.rs (target\debug\deps\golden-47f3e3fd84675e0e.exe)

running 8 tests
test one ... ok
error: test failed, to rerun pass `-p jaq --test golden`

Caused by:
  process didn't exit successfully: `C:\code-projects\jaq\target\debug\deps\golden-47f3e3fd84675e0e.exe` (exit code: 2)

Here is the output, running on Windows 11 Latest

sparse() fails with following -

Expected output:
[
  2,
  3
]
---
Actual output:
[
  2,
  3
]

---

compact() fails with following -

Expected output:
[2,3]
{"a":1,"b":["c"]}
---
Actual output:
[2,3]
{"a":1,"b":["c"]}

---

inputs() fails with following -

Expected output:
{".":0}
{"input":1}
{".":2}
{"input":3}

---
Actual output:
{".":0}
{"input":1}
{".":2}
{"input":3}

---

null_input() fails with following -

Expected output:
{".":null}
{"inputs":[0,1,2,3]}

---
Actual output:
{".":null}
{"inputs":[0,1,2,3]}

---

A clear (possible) pattern I see is the \r character messing things up. The outputs do look similar and I think the tests should remove all characters of \r to make tests run on all platforms.

I might work on this if I have the time. However this seems like a good first issue for people willing to work.

I think that I have found the culprit. Could you test this again?

I am so sorry for the late reply. I will test it today.

Nope still fails

On Windows

PS C:\code-projects\Random\jaq> cargo test   
    Finished test [unoptimized + debuginfo] target(s) in 0.10s
     Running unittests src\main.rs (target\debug\deps\jaq-b59185a926e81666.exe)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests\golden.rs (target\debug\deps\golden-fef09157fb76f05d.exe)

running 8 tests
test arg ... ok
test one ... ok
error: test failed, to rerun pass `-p jaq --test golden`

Caused by:
  process didn't exit successfully: `C:\code-projects\Random\jaq\target\debug\deps\golden-fef09157fb76f05d.exe` (exit code: 2)

This seems to fail on WSL as well. I'm confused.

I note that above (#87 (comment)), the tests failed after "one", whereas here, they failed after "arg" and "one". Is that by chance?
Apart from this, as I do not have a Windows machine, I do not feel motivated to chase this down. If you wish to diagnose this further, go ahead.

@nouritsu, do things work now? (I redid large parts of the testing infrastructure recently.)

@01mf02 Yes, I closed the issue after checking if all tests pass. They all seem to pass on my machine after following the replication steps I had mentioned.