summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTom Black <[email protected]>2016-12-24 22:17:34 -0600
committerTom Black <[email protected]>2016-12-24 22:17:34 -0600
commite81d32b470cdead1c114b6d1b5b6bda958d6b1ad (patch)
tree3d61e376c8f460b2ff932cb9f9104f2e0cf5b72e
parent326b74d485ce81c0a4e1da0e5158a2c83e028915 (diff)
downloadruby2d-e81d32b470cdead1c114b6d1b5b6bda958d6b1ad.tar.gz
ruby2d-e81d32b470cdead1c114b6d1b5b6bda958d6b1ad.zip
Merge all tests into `test/` directory
-rw-r--r--.gitmodules4
-rw-r--r--.rspec3
-rw-r--r--Rakefile14
-rw-r--r--test/color_spec.rb (renamed from spec/color_spec.rb)0
-rw-r--r--test/controller.rb (renamed from tests/controller.rb)10
-rw-r--r--test/dsl_spec.rb (renamed from spec/dsl_spec.rb)0
-rw-r--r--test/input.rb49
-rw-r--r--test/spec_helper.rb (renamed from spec/spec_helper.rb)0
-rw-r--r--test/sprite_spec.rb (renamed from spec/sprite_spec.rb)0
-rw-r--r--test/testcard.rb (renamed from tests/testcard.rb)0
-rw-r--r--tests/input.rb67
m---------tests/media0
12 files changed, 70 insertions, 77 deletions
diff --git a/.gitmodules b/.gitmodules
index a123c40..2ad3adc 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,5 +1,5 @@
-[submodule "tests/media"]
- path = tests/media
+[submodule "test/media"]
+ path = test/media
url = https://github.com/simple2d/test_media.git
[submodule "assets"]
path = assets
diff --git a/.rspec b/.rspec
index 83e16f8..fc3c9e9 100644
--- a/.rspec
+++ b/.rspec
@@ -1,2 +1,3 @@
---color
+--default-path test
--require spec_helper
+--color
diff --git a/Rakefile b/Rakefile
index bc22822..fc4cdc1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -27,8 +27,8 @@ def run_cmd(cmd)
end
def run_test(file)
- print_task "Running tests/#{file}.rb"
- system "( cd tests/ ; ruby #{file}.rb )"
+ print_task "Running test/#{file}.rb"
+ system "( cd test/ ; ruby #{file}.rb )"
end
# Tasks
@@ -56,7 +56,7 @@ end
desc "Run the RSpec tests"
RSpec::Core::RakeTask.new do |t|
print_task "Running RSpec"
- t.pattern = "spec/*spec.rb"
+ t.pattern = "test/*spec.rb"
end
desc "Run testcard"
@@ -72,15 +72,15 @@ end
desc "Run native build test"
task :native do
print_task "Running native build test"
- run_cmd "ruby2d build native tests/testcard.rb"
- print_task "Running native tests/testcard.rb"
- system "( cd tests/ ; ../build/app )"
+ run_cmd "ruby2d build native test/testcard.rb"
+ print_task "Running native test/testcard.rb"
+ system "( cd test/ ; ../build/app )"
end
desc "Run web build test"
task :web do
print_task "Running web build test"
- run_cmd "ruby2d build web tests/testcard.rb"
+ run_cmd "ruby2d build web test/testcard.rb"
end
desc "Uninstall, build, install, and test"
diff --git a/spec/color_spec.rb b/test/color_spec.rb
index ed23712..ed23712 100644
--- a/spec/color_spec.rb
+++ b/test/color_spec.rb
diff --git a/tests/controller.rb b/test/controller.rb
index e54df9d..0007ddd 100644
--- a/tests/controller.rb
+++ b/test/controller.rb
@@ -34,4 +34,14 @@ on controller: 3 do
puts "conroller btn 3"
end
+on_controller do |which, is_axis, axis, val, is_btn, btn|
+ puts "=== Controller Pressed ===",
+ "which: which",
+ "is_axis: #{is_axis}",
+ "axis: #{axis}",
+ "val: #{val}",
+ "is_btn: #{is_btn}",
+ "btn: #{btn}"
+end
+
show
diff --git a/spec/dsl_spec.rb b/test/dsl_spec.rb
index 6d3d8b4..6d3d8b4 100644
--- a/spec/dsl_spec.rb
+++ b/test/dsl_spec.rb
diff --git a/test/input.rb b/test/input.rb
new file mode 100644
index 0000000..9c8d7b2
--- /dev/null
+++ b/test/input.rb
@@ -0,0 +1,49 @@
+require 'ruby2d'
+
+set width: 200, height: 100, title: "Ruby 2D – Input"
+
+on key_down: 'a' do
+ puts "Key 'a' pressed"
+end
+
+on key: 'a' do
+ puts "Key 'a' held down"
+end
+
+on key_up: 'a' do
+ puts "Key 'a' released"
+end
+
+on key_down: 'any' do
+ puts "A key was pressed"
+end
+
+on_key do |key|
+ puts "on_key: #{key}"
+end
+
+on mouse: 'left' do
+ puts "mouse left"
+end
+
+on mouse: 'right' do
+ puts "mouse right"
+end
+
+on mouse: 'down' do
+ puts "mouse down"
+end
+
+on mouse: 'up' do
+ puts "mouse up"
+end
+
+on mouse: 'any' do
+ puts "mouse any"
+end
+
+on key: 'escape' do
+ close
+end
+
+show
diff --git a/spec/spec_helper.rb b/test/spec_helper.rb
index d93bff8..d93bff8 100644
--- a/spec/spec_helper.rb
+++ b/test/spec_helper.rb
diff --git a/spec/sprite_spec.rb b/test/sprite_spec.rb
index 42268be..42268be 100644
--- a/spec/sprite_spec.rb
+++ b/test/sprite_spec.rb
diff --git a/tests/testcard.rb b/test/testcard.rb
index dfe049b..dfe049b 100644
--- a/tests/testcard.rb
+++ b/test/testcard.rb
diff --git a/tests/input.rb b/tests/input.rb
deleted file mode 100644
index fbf0530..0000000
--- a/tests/input.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-require 'ruby2d'
-
-set width: 200, height: 100, title: "Ruby 2D – Input"
-
-on key: 'a' do
- puts "on key: 'a'"
-end
-
-on key_up: 's' do
- puts "on key_up: 's'"
-end
-
-on key_down: 'd' do
- puts "on key_down: 'd'"
-end
-
-on key: 'any' do
- puts "on key: 'any'"
-end
-
-on key_down: 'any' do
- puts "on key_down: 'any'"
-end
-
-on key_up: 'any' do
- puts "on key_up: 'any'"
-end
-
-on_key do |key|
- puts "on_key: #{key}"
-end
-
-on_controller do |which, is_axis, axis, val, is_btn, btn|
- puts "=== Controller Pressed ===",
- "which: which",
- "is_axis: #{is_axis}",
- "axis: #{axis}",
- "val: #{val}",
- "is_btn: #{is_btn}",
- "btn: #{btn}"
-end
-
-on mouse: 'left' do
- puts "mouse left"
-end
-
-on mouse: 'right' do
- puts "mouse right"
-end
-
-on mouse: 'down' do
- puts "mouse down"
-end
-
-on mouse: 'up' do
- puts "mouse up"
-end
-
-on mouse: 'any' do
- puts "mouse any"
-end
-
-on key: 'escape' do
- close
-end
-
-show
diff --git a/tests/media b/tests/media
deleted file mode 160000
-Subproject fd57d1c22c11b1cc84b160236718b7e26c438a3