Commit d18c6902 authored by Antonio Terceiro's avatar Antonio Terceiro

t/testdep: port to test/unit

parent 9dbf582d
require 'runit/testcase'
require 'runit/cui/testrunner'
require 'test/unit'
$:.unshift("../lib")
require '../lib/debian.rb'
require 'debian'
class TestDebian__Dep < RUNIT::TestCase
class TestDebian__Dep < Test::Unit::TestCase
def setup
@dep = [Debian::Dep.new("w3m", 'Depends'),
......@@ -15,10 +13,10 @@ class TestDebian__Dep < RUNIT::TestCase
end
def test_satisfy?
deb = [Debian::Deb.new(IO.readlines("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("d/w3m-ssl_0.2.1-1.f").join("")),
Debian::Deb.new(IO.readlines("d/w3m-ssl_0.2.1-2.f").join(""))]
deb = [Debian::Deb.new(IO.readlines("t/d/w3m_0.2.1-1.f").join("")),
Debian::Deb.new(IO.readlines("t/d/w3m_0.2.1-2.f").join("")),
Debian::Deb.new(IO.readlines("t/d/w3m-ssl_0.2.1-1.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[1]))
assert(!(@dep[0].satisfy?(deb[2])))
......@@ -36,19 +34,19 @@ class TestDebian__Dep < RUNIT::TestCase
end
def test_to_s
assert_equals("Depends w3m", @dep[0].to_s)
assert_equals("Depends w3m | w3m-ssl", @dep[1].to_s)
assert_equals("Recommends w3m (>= 0.2.1-2) | w3m-ssl (>= 0.2.1-2)",
assert_equal("Depends w3m", @dep[0].to_s)
assert_equal("Depends w3m | w3m-ssl", @dep[1].to_s)
assert_equal("Recommends w3m (>= 0.2.1-2) | w3m-ssl (>= 0.2.1-2)",
@dep[2].to_s)
end
def test_unmet
p = Debian::Packages.new("d/w3m_met_list")
assert_equals([], @dep[0].unmet(p)) # w3m
assert_equals([], @dep[1].unmet(p)) # w3m | w3m-ssl
assert_equals([], @dep[2].unmet(p))
p = Debian::Packages.new("t/d/w3m_met_list")
assert_equal([], @dep[0].unmet(p)) # w3m
assert_equal([], @dep[1].unmet(p)) # w3m | w3m-ssl
assert_equal([], @dep[2].unmet(p))
# 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
# def test_s_new
......@@ -56,15 +54,3 @@ class TestDebian__Dep < RUNIT::TestCase
# 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