yaml / yamlscript

Programming in YAML
MIT License
358 stars 31 forks source link

rust: Display isntall isntruction on `NotFound` #126

Closed Ethiraric closed 3 months ago

Ethiraric commented 3 months ago

Fixes #122

Ethiraric commented 3 months ago

This changes the way the error is printed for the NotFound variant to the given string.

For all other variants, it uses the default formatting (x => x.fmt(f)). The default formatting was what we were using for all variants up to this point.

Ethiraric commented 3 months ago

Here's an example output from running the tests without the lib:

---- load_sample_error stdout ----
thread 'load_sample_error' panicked at tests/load.rs:57:44:
called `Result::unwrap()` on an `Err` value: Shared library file 'libyamlscript.so.0.1.49' not found
Try: curl -sSL yamlscript.org/install | VERSION=0.1.49 LIB=1 bash
See: https://github.com/yaml/yamlscript/wiki/Installing-YAMLScript
ingydotnet commented 3 months ago

Thanks. Can you also look in $HOME/.local/lib after /usr/local/lib?

Ethiraric commented 3 months ago

This is the current behavior. /usr/local/lib is pushed first and looked in first.

ingydotnet commented 3 months ago

Sorry, I was looking in the diff, but I forgot that behavior was already implemented.

ingydotnet commented 3 months ago

I'm getting an error with the tests:


$ make -C rust test
make: Entering directory '/home/ingy/src/yamlscript/rust'
cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests src/lib.rs (target/debug/deps/yamlscript-908c6d55c850b71c)

running 0 tests

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

     Running tests/load.rs (target/debug/deps/load-1aff250989321444)

running 5 tests
test load_loop ... ignored

thread 'load_sample_error' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass `--test load`

Caused by:
  process didn't exit successfully: `/home/ingy/src/yamlscript/rust/target/debug/deps/load-1aff250989321444` (signal: 6, SIGABRT: process abort signal)
make: *** [Makefile:15: test] Error 101
make: Leaving directory '/home/ingy/src/yamlscript/rust'
Ethiraric commented 3 months ago

I'm getting an error with the tests:

My bad. x.fmt(f) is a recursive call... I didn't have the correct version installed so the only NotFound test I had passed (the only one not triggering the infinite recursion).

ingydotnet commented 3 months ago

Merged. Thanks!