instiki/vendor/rubyzip-0.5.8/test/ziprequiretest.rb

44 lines
998 B
Ruby
Raw Normal View History

2005-01-15 21:26:54 +01:00
#!/usr/bin/env ruby
$VERBOSE = true
2005-04-10 18:55:44 +02:00
$: << "../lib"
2005-01-15 21:26:54 +01:00
2005-04-10 18:55:44 +02:00
require 'test/unit'
2005-01-15 21:26:54 +01:00
require 'zip/ziprequire'
2005-04-10 18:55:44 +02:00
$: << 'data/rubycode.zip' << 'data/rubycode2.zip'
2005-01-15 21:26:54 +01:00
2005-04-10 18:55:44 +02:00
class ZipRequireTest < Test::Unit::TestCase
2005-01-15 21:26:54 +01:00
def test_require
2005-04-10 18:55:44 +02:00
assert(require('data/notzippedruby'))
assert(!require('data/notzippedruby'))
2005-01-15 21:26:54 +01:00
assert(require('zippedruby1'))
assert(!require('zippedruby1'))
assert(require('zippedruby2'))
assert(!require('zippedruby2'))
assert(require('zippedruby3'))
assert(!require('zippedruby3'))
c1 = NotZippedRuby.new
assert(c1.returnTrue)
assert(ZippedRuby1.returnTrue)
assert(!ZippedRuby2.returnFalse)
2005-04-10 18:55:44 +02:00
assert_equal(4, ZippedRuby3.multiplyValues(2, 2))
2005-01-15 21:26:54 +01:00
end
def test_get_resource
get_resource("aResource.txt") {
|f|
2005-04-10 18:55:44 +02:00
assert_equal("Nothing exciting in this file!", f.read)
2005-01-15 21:26:54 +01:00
}
end
end
# Copyright (C) 2002 Thomas Sondergaard
# rubyzip is free software; you can redistribute it and/or
# modify it under the terms of the ruby license.