File tree Expand file tree Collapse file tree 5 files changed +67
-0
lines changed Expand file tree Collapse file tree 5 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 2828 ./tests/scripts/test-runner.sh
2929 ./tests/scripts/test-runner.sh
3030
31+ test-examples :
32+ strategy :
33+ matrix :
34+ os : [ubuntu-latest, macos-latest]
35+ rust : ["1.64.0", "stable"]
36+ runs-on : ${{ matrix.os }}
37+ steps :
38+ - name : Checkout source
39+ uses : actions/checkout@v3
40+ - name : Setup rust
41+ uses : dtolnay/rust-toolchain@stable
42+ with :
43+ toolchain : ${{ matrix.rust }}
44+ - name : Install just
45+ uses : taiki-e/install-action@just
46+ - name : Install rust-script
47+ run : cargo install --path .
48+ - name : Test examples
49+ run : ./test-examples.sh
50+ working-directory : examples
51+
3152 check-format :
3253 runs-on : ubuntu-latest
3354 steps :
Original file line number Diff line number Diff line change 1+ demo :
2+ #!/ usr/ bin/ env rust-script --base-path {{ justfile_directory ()}}
3+ // ! ``` cargo
4+ //! [dependencies]
5+ //! dummy = { path = " ./dummy" }
6+ //! ` ` `
7+ fn main () {
8+ let result = dummy::add(1, 2);
9+ println! (" result: {}" , result);
10+ }
11+
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " dummy"
3+ version = " 0.1.0"
4+ edition = " 2021"
5+
6+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+ [dependencies ]
Original file line number Diff line number Diff line change 1+ pub fn add ( left : usize , right : usize ) -> usize {
2+ left + right
3+ }
4+
5+ #[ cfg( test) ]
6+ mod tests {
7+ use super :: * ;
8+
9+ #[ test]
10+ fn it_works ( ) {
11+ let result = add ( 2 , 2 ) ;
12+ assert_eq ! ( result, 4 ) ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e -u
3+
4+ assert_equals () {
5+ if [ " $1 " != " $2 " ]; then
6+ echo " Invalid output: Expected '$1 ', was '$2 '"
7+ exit 1
8+ fi
9+ }
10+
11+ assert_equals " result: 3" " $( just -f justfile/Justfile) "
12+ assert_equals " hello, rust" " $( ./hello.ers) "
13+ assert_equals " hello, rust" " $( ./hello-without-main.ers) "
You can’t perform that action at this time.
0 commit comments