mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
Easier removal of temporary files for test classes. Added a new exception for handling inside the test classes themselves so that they do not have to use RuntimeError which is used extensively by the Test class itself.
This commit is contained in:
parent
af3eee55e5
commit
1c493df414
15
tests/run.rb
15
tests/run.rb
@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/ruby
|
#!/usr/bin/ruby
|
||||||
|
|
||||||
|
class SubtestError < RuntimeError
|
||||||
|
end
|
||||||
|
|
||||||
class Test
|
class Test
|
||||||
attr_reader :commands
|
attr_reader :commands
|
||||||
attr_reader :debug_commands
|
attr_reader :debug_commands
|
||||||
@ -18,14 +21,18 @@ class Test
|
|||||||
return error("Trying to run the base class")
|
return error("Trying to run the base class")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def unlink_tmp_files
|
||||||
|
n = "mkvtoolnix-auto-test-" + $$.to_s + "-"
|
||||||
|
Dir.entries("/tmp").each do |e|
|
||||||
|
File.unlink("/tmp/#{e}") if (e =~ /^#{n}/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def run_test
|
def run_test
|
||||||
begin
|
begin
|
||||||
return run
|
return run
|
||||||
rescue RuntimeError => ex
|
rescue RuntimeError => ex
|
||||||
n = "mkvtoolnix-auto-test-" + $$.to_s + "-"
|
unlink_tmp_files
|
||||||
Dir.entries("/tmp").each do |e|
|
|
||||||
File.unlink("/tmp/#{e}") if (e =~ /^#{n}/)
|
|
||||||
end
|
|
||||||
puts(ex.to_s)
|
puts(ex.to_s)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user