more tests
authorKlaus Kaempf <kkaempf@suse.de>
Thu, 7 Aug 2008 16:31:57 +0000 (16:31 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Thu, 7 Aug 2008 16:31:57 +0000 (16:31 +0000)
swig/ruby/tests/arch.rb [new file with mode: 0755]
swig/ruby/tests/target.rb [new file with mode: 0755]

diff --git a/swig/ruby/tests/arch.rb b/swig/ruby/tests/arch.rb
new file mode 100755 (executable)
index 0000000..3677afb
--- /dev/null
@@ -0,0 +1,18 @@
+#
+# Example for Arch
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+  require 'zypp'
+  include Zypp
+  def test_arch
+    a = Arch.new("i386")
+    assert a
+    puts a.to_s
+#    assert a.to_s == "i386"
+  end
+end
diff --git a/swig/ruby/tests/target.rb b/swig/ruby/tests/target.rb
new file mode 100755 (executable)
index 0000000..b54bbdc
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Example for target
+#
+
+$:.unshift "../../../build/swig/ruby"
+
+
+# test loading of extension
+require 'test/unit'
+
+class LoadTest < Test::Unit::TestCase
+  require 'zypp'
+  include Zypp
+  def test_target
+    z = ZYppFactory::instance.get_zypp
+
+    assert z.home_path
+    assert z.tmp_path
+
+    z.initialize_target(Zypp::Pathname.new("/"))
+    t = z.target
+    assert t
+    t.load
+    t.build_cache
+    
+    p = z.pool
+    assert p
+    assert p.size > 0
+    
+    # Iterate over pool, gives PoolItems
+    i = 0
+    puts "#{p.size} PoolItems:"
+    p.each do | pi |
+      i = i + 1
+      break if i > 10
+      puts pi
+      # PoolItems have status and a resolvable
+#      r = pi.resolvable
+#      puts "#{r.name}-#{r.edition}"
+    end
+
+    assert true
+  end
+end