diff --git a/bin/dep b/bin/dep index 192277f..8d895bb 100755 --- a/bin/dep +++ b/bin/dep @@ -125,7 +125,7 @@ module Dep end def self.abort - abort("error: dep --help for more info") + Kernel::abort("error: dep --help for more info") end end end diff --git a/test/dep.rb b/test/dep.rb index 91a0c40..e93cdef 100644 --- a/test/dep.rb +++ b/test/dep.rb @@ -51,3 +51,25 @@ assert list.libraries.include?(Dep::Lib.new("cutest", "2.0")) end end + +# Dep::CLI +scope do + def silence_unless_raises + begin + original_stderr = $stderr.clone + $stderr.reopen(File.new('/dev/null', 'w')) + yield + rescue Exception + $stderr.reopen(original_stderr) + raise + ensure + $stdout.reopen(original_stderr) + end + end + + test "abort doesn't raise an exception" do + silence_unless_raises do + Dep::CLI.abort + end + end +end