summaryrefslogtreecommitdiffhomepage
path: root/samples/10_advanced_debugging/03_unit_tests/require_tests.rb
blob: 7ebfc3a083f3760b9ce4ba5129d680cfbbc19f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def write_src path, src
  $gtk.write_file path, src
end

write_src 'app/unit_testing_game.rb', <<-S
module UnitTesting
  class Game
  end
end
S

write_src 'lib/unit_testing_lib.rb', <<-S
module UnitTesting
  class Lib
  end
end
S

write_src 'app/nested/unit_testing_nested.rb', <<-S
module UnitTesting
  class Nested
  end
end
S

require 'app/unit_testing_game.rb'
require 'app/nested/unit_testing_nested.rb'
require 'lib/unit_testing_lib.rb'

def test_require args, assert
  UnitTesting::Game.new
  UnitTesting::Lib.new
  UnitTesting::Nested.new
  $gtk.exec 'rm ./mygame/app/unit_testing_game.rb'
  $gtk.exec 'rm ./mygame/app/nested/unit_testing_nested.rb'
  $gtk.exec 'rm ./mygame/lib/unit_testing_lib.rb'
  assert.ok!
end