Skip to content

Commit

Permalink
Add test selector runner
Browse files Browse the repository at this point in the history
  • Loading branch information
hernangonzalez committed Nov 4, 2024
1 parent 38625b0 commit 614c970
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/book/build
/book/build
Gemfile.lock
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "tomlrb"
27 changes: 27 additions & 0 deletions run_tests.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'tomlrb'

# Helper functions
def ensure_build
system "cargo build --release"
if $?.exitstatus != 0
puts "Oops, we could not build the project!"
exit 1
end
end

def select_stage
toml_data = Tomlrb.load_file('Course.toml')
return toml_data['test']['level']
end

# Build the project
puts "Building the project..."
ensure_build

# Run the tests
puts "Running tests..."
stage = select_stage
system "cargo test --release --features stage#{stage}"

# Congrats!
puts "All Done!"
1 change: 0 additions & 1 deletion tests/stage4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

mod helpers;

use helpers::{split_ls_column_output, split_ls_output_by_newline};
use rstest::rstest;
use std::process::Command;

Expand Down

0 comments on commit 614c970

Please sign in to comment.