-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from rust-lang-ar/staged_testing
Add test runner
- Loading branch information
Showing
8 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/target | ||
/book/build | ||
/book/build | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'toml-rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'toml-rb' | ||
|
||
# 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 | ||
path = File.join(File.dirname(__FILE__), 'Course.toml') | ||
toml_data = TomlRB.load_file(path) | ||
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!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'toml-rb' | ||
|
||
# Load the toml file | ||
path = File.join(File.dirname(__FILE__), 'Course.toml') | ||
toml_data = TomlRB.load_file(path) | ||
|
||
# Upgrade the stage | ||
stage = toml_data['test']['level'] | ||
next_stage = Integer(stage) + 1 | ||
puts "Upgrading to stage #{next_stage}..." | ||
toml_data['test']['level'] = next_stage.to_s | ||
|
||
# Save the file | ||
data = TomlRB.dump(toml_data) | ||
File.write(path, data) | ||
puts "All done!" |