How to create Rust examples without running

Is there a way to create Rust examples without running them? In particular, for successful testing of examples using Travis CI.

+3


source to share


3 answers


cargo test

automatically creates examples (but does not run them). I believe it does this first before the main test participants, but you can test with cargo test -v

.



+4


source


I am using the following code to run from Travis



language: rust
rust:
  - stable
  - beta
script:
  - cargo build --verbose --all
  - cargo test --verbose --all

      

+1


source


cargo test

runs examples.

To create them, I do this:

for i in examples/*; do cargo build --target=x86_64-pc-windows-gnu --verbose --example $(basename $i .rs); done

      

Delivery issue # 192 covers feature request for something like this.

0


source







All Articles