diff options
| author | Tom Black <[email protected]> | 2017-02-17 01:06:53 -0500 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2017-02-17 01:06:53 -0500 |
| commit | 58dc0a97dd56a148d748e0dedf8430dd89fdcbe6 (patch) | |
| tree | 0923fc5659aacecd96187ec5472e82f4e4a8c3f9 /Rakefile | |
| parent | 19232508ff32412dc9e64fb0e44ee56d38a0abee (diff) | |
| download | ruby2d-58dc0a97dd56a148d748e0dedf8430dd89fdcbe6.tar.gz ruby2d-58dc0a97dd56a148d748e0dedf8430dd89fdcbe6.zip | |
Make it easier to run native and web tests
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 43 |
1 files changed, 27 insertions, 16 deletions
@@ -17,6 +17,10 @@ if `which simple2d`.empty? exit end +def get_args + ARGV.each { |a| task a.to_sym do ; end } +end + def print_task(task) print "\n", "==> ".blue, task.bold, "\n\n" end @@ -31,6 +35,19 @@ def run_test(file) system "( cd test/ ; ruby #{file}.rb )" end +def run_native_test(file) + print_task "Running native test: #{file}.rb" + run_cmd "ruby2d build --native test/#{file}.rb --debug" + print_task "Running native test/#{file}.rb" + system "( cd test/ ; ../build/app )" +end + +def run_web_test(file) + print_task "Running web build test" + run_cmd "ruby2d build --web test/#{file}.rb --debug" + system "open build/app.html" +end + # Tasks task default: 'all' @@ -59,28 +76,22 @@ RSpec::Core::RakeTask.new do |t| t.pattern = "test/*spec.rb" end -desc "Run testcard" -task :testcard do - run_test 'testcard' -end - -desc "Run input tests" -task :input do - run_test 'input' +desc "Run test" +task :test do + get_args + run_test ARGV[1] end -desc "Run native build test" +desc "Run native test" task :native do - print_task "Running native build test" - run_cmd "ruby2d build native test/testcard.rb" - print_task "Running native test/testcard.rb" - system "( cd test/ ; ../build/app )" + get_args + run_native_test ARGV[1] end -desc "Run web build test" +desc "Run web test" task :web do - print_task "Running web build test" - run_cmd "ruby2d build web test/testcard.rb" + get_args + run_web_test ARGV[1] end desc "Uninstall, build, install, and test" |
