Commit d18c6902 authored by Antonio Terceiro's avatar Antonio Terceiro

t/testdep: port to test/unit

parent 9dbf582d
require 'runit/testcase' require 'test/unit'
require 'runit/cui/testrunner'
$:.unshift("../lib") require 'debian'
require '../lib/debian.rb'
class TestDebian__Dep < RUNIT::TestCase class TestDebian__Dep < Test::Unit::TestCase
def setup def setup
@dep = [Debian::Dep.new("w3m", 'Depends'), @dep = [Debian::Dep.new("w3m", 'Depends'),
...@@ -15,10 +13,10 @@ class TestDebian__Dep < RUNIT::TestCase ...@@ -15,10 +13,10 @@ class TestDebian__Dep < RUNIT::TestCase
end end
def test_satisfy? def test_satisfy?
deb = [Debian::Deb.new(IO.readlines("d/w3m_0.2.1-1.f").join("")), deb = [Debian::Deb.new(IO.readlines("t/d/w3m_0.2.1-1.f").join("")),
Debian::Deb.new(IO.readlines("d/w3m_0.2.1-2.f").join("")), Debian::Deb.new(IO.readlines("t/d/w3m_0.2.1-2.f").join("")),
Debian::Deb.new(IO.readlines("d/w3m-ssl_0.2.1-1.f").join("")), Debian::Deb.new(IO.readlines("t/d/w3m-ssl_0.2.1-1.f").join("")),
Debian::Deb.new(IO.readlines("d/w3m-ssl_0.2.1-2.f").join(""))] Debian::Deb.new(IO.readlines("t/d/w3m-ssl_0.2.1-2.f").join(""))]
assert(@dep[0].satisfy?(deb[0])) assert(@dep[0].satisfy?(deb[0]))
assert(@dep[0].satisfy?(deb[1])) assert(@dep[0].satisfy?(deb[1]))
assert(!(@dep[0].satisfy?(deb[2]))) assert(!(@dep[0].satisfy?(deb[2])))
...@@ -36,19 +34,19 @@ class TestDebian__Dep < RUNIT::TestCase ...@@ -36,19 +34,19 @@ class TestDebian__Dep < RUNIT::TestCase
end end
def test_to_s def test_to_s
assert_equals("Depends w3m", @dep[0].to_s) assert_equal("Depends w3m", @dep[0].to_s)
assert_equals("Depends w3m | w3m-ssl", @dep[1].to_s) assert_equal("Depends w3m | w3m-ssl", @dep[1].to_s)
assert_equals("Recommends w3m (>= 0.2.1-2) | w3m-ssl (>= 0.2.1-2)", assert_equal("Recommends w3m (>= 0.2.1-2) | w3m-ssl (>= 0.2.1-2)",
@dep[2].to_s) @dep[2].to_s)
end end
def test_unmet def test_unmet
p = Debian::Packages.new("d/w3m_met_list") p = Debian::Packages.new("t/d/w3m_met_list")
assert_equals([], @dep[0].unmet(p)) # w3m assert_equal([], @dep[0].unmet(p)) # w3m
assert_equals([], @dep[1].unmet(p)) # w3m | w3m-ssl assert_equal([], @dep[1].unmet(p)) # w3m | w3m-ssl
assert_equals([], @dep[2].unmet(p)) assert_equal([], @dep[2].unmet(p))
# w3m (>= 0.2.1-2) | w3m-ssl (>= 0.2.1-2) # w3m (>= 0.2.1-2) | w3m-ssl (>= 0.2.1-2)
assert_equals([], @dep[3].unmet(p)) # www-browser assert_equal([], @dep[3].unmet(p)) # www-browser
end end
# def test_s_new # def test_s_new
...@@ -56,15 +54,3 @@ class TestDebian__Dep < RUNIT::TestCase ...@@ -56,15 +54,3 @@ class TestDebian__Dep < RUNIT::TestCase
# end # end
end end
if $0 == __FILE__
if ARGV.size == 0
suite = TestDebian__Dep.suite
else
suite = RUNIT::TestSuite.new
ARGV.each do |testmethod|
suite.add_test(TestDebian__Dep.new(testmethod))
end
end
RUNIT::CUI::TestRunner.run(suite)
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment