code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
begin
require "openssl"
rescue LoadError
end
require "test/unit"
if defined?(OpenSSL)
class OpenSSL::TestCipher < Test::Unit::TestCase
def setup
@c1 = OpenSSL::Cipher::Cipher.new("DES-EDE3-CBC")
@c2 = OpenSSL::Cipher::DES.new(:EDE3, "CBC")
@key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
... | Ruby |
begin
require "openssl"
require File.join(File.dirname(__FILE__), "utils.rb")
rescue LoadError
end
require "test/unit"
if defined?(OpenSSL::PKey::EC)
class OpenSSL::TestEC < Test::Unit::TestCase
def setup
@data1 = 'foo'
@data2 = 'bar' * 1000 # data too long for DSA sig
@group1 = OpenSSL::PKey::EC::... | Ruby |
begin
require "openssl"
require File.join(File.dirname(__FILE__), "utils.rb")
rescue LoadError
end
require 'test/unit'
class OpenSSL::TestASN1 < Test::Unit::TestCase
def test_decode
subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCA")
key = OpenSSL::TestUtils::TEST_KEY_RSA1024
now = Ti... | Ruby |
begin
require "openssl"
require File.join(File.dirname(__FILE__), "utils.rb")
rescue LoadError
end
require 'test/unit'
if defined?(OpenSSL)
class OpenSSL::TestPKeyRSA < Test::Unit::TestCase
def test_padding
key = OpenSSL::PKey::RSA.new(512, 3)
# Need right size for raw mode
plain0 = "x" * (512/8)
... | Ruby |
begin
require "openssl"
require File.join(File.dirname(__FILE__), "utils.rb")
rescue LoadError
end
if defined?(OpenSSL)
class OpenSSL::TestBN < Test::Unit::TestCase
def test_integer_to_bn
assert_equal(999.to_bn, OpenSSL::BN.new(999.to_s(16), 16))
assert_equal((2 ** 107 - 1).to_bn, OpenSSL::BN.new((2 ** ... | Ruby |
require 'openssl'
require "test/unit"
require 'tempfile'
require File.join(File.dirname(__FILE__), "utils.rb")
class OpenSSL::TestConfig < Test::Unit::TestCase
def setup
file = Tempfile.open("openssl.cnf")
file << <<__EOD__
HOME = .
[ ca ]
default_ca = CA_default
[ CA_default ]
dir = ./demoCA
certs ... | Ruby |
begin
require "openssl"
rescue LoadError
end
require "test/unit"
if defined?(OpenSSL)
class OpenSSL::TestX509Name < Test::Unit::TestCase
OpenSSL::ASN1::ObjectId.register(
"1.2.840.113549.1.9.1", "emailAddress", "emailAddress")
OpenSSL::ASN1::ObjectId.register(
"2.5.4.5", "serialNumber", "serialNumber")
... | Ruby |
require "socket"
require "thread"
require "openssl"
require File.join(File.dirname(__FILE__), "utils.rb")
def get_pem(io=$stdin)
buf = ""
while line = io.gets
if /^-----BEGIN / =~ line
buf << line
break
end
end
while line = io.gets
buf << line
if /^-----END / =~ line
break
... | Ruby |
begin
require "openssl"
require File.join(File.dirname(__FILE__), "utils.rb")
rescue LoadError
end
require "test/unit"
if defined?(OpenSSL)
class OpenSSL::TestPKCS7 < Test::Unit::TestCase
def setup
@rsa1024 = OpenSSL::TestUtils::TEST_KEY_RSA1024
@rsa2048 = OpenSSL::TestUtils::TEST_KEY_RSA2048
ca = O... | Ruby |
require 'stringio'
require 'tempfile'
require 'test/unit'
require 'rdoc/parsers/parse_c'
class RDoc::C_Parser
attr_accessor :classes
public :do_classes, :do_constants
end
class TestRdocC_Parser < Test::Unit::TestCase
def setup
@tempfile = Tempfile.new self.class.name
filename = @tempfile.path
@to... | Ruby |
require 'test/unit'
require 'xsd/codegen/classdef'
module XSD; module CodeGen
class TestClassDefCreator < Test::Unit::TestCase
include XSD::CodeGen
include GenSupport
def test_classdef_simple
c = ClassDef.new("Foo")
assert_equal(format(<<-EOD), c.dump)
class Foo
end
EOD
end
def t... | Ruby |
require 'test/unit'
require 'wsdl/xmlSchema/parser'
module XSD
class TestEmptyCharset < Test::Unit::TestCase
def setup
@file = File.join(File.dirname(File.expand_path(__FILE__)), 'noencoding.xml')
end
def test_wsdl
begin
xml = WSDL::XMLSchema::Parser.new.parse(File.open(@file) { |f| f.read })
... | Ruby |
require 'test/unit'
require 'xsd/datatypes'
module XSD
class TestXSD < Test::Unit::TestCase
NegativeZero = (-1.0 / (1.0 / 0.0))
def setup
end
def teardown
end
def assert_parsed_result(klass, str)
o = klass.new(str)
assert_equal(str, o.to_s)
end
def test_NSDBase
o = XSD::NSDBase.new
... | Ruby |
require 'test/unit'
require 'wsdl/xmlSchema/parser'
module XSD
class TestXMLSchemaParser < Test::Unit::TestCase
def setup
@file = File.join(File.dirname(File.expand_path(__FILE__)), 'xmlschema.xml')
end
def test_wsdl
@wsdl = WSDL::XMLSchema::Parser.new.parse(File.open(@file) { |f| f.read })
asser... | Ruby |
require 'test/unit'
rcsid = %w$Id: runner.rb 26083 2009-12-13 18:50:31Z shyouhei $
Version = rcsid[2].scan(/\d+/).collect!(&method(:Integer)).freeze rescue nil
Release = rcsid[3].freeze rescue nil
exit Test::Unit::AutoRunner.run(true, File.dirname($0))
| Ruby |
require 'test/unit'
require 'erb'
class TestERB < Test::Unit::TestCase
class MyError < RuntimeError ; end
def test_without_filename
erb = ERB.new("<% raise ::TestERB::MyError %>")
e = assert_raise(MyError) {
erb.result
}
assert_equal("(erb):1", e.backtrace[0])
end
def test_with_filename... | Ruby |
require 'drb/drb'
require 'drb/extserv'
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <uri> <name>" unless it
it
end
DRb.start_service(nil, [1, 2, 'III', 4, "five", 6])
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
end
| Ruby |
require 'drb/drb'
require 'drb/extserv'
class EvalAttack
def initialize
@four = DRb::DRbServer.new('druby://localhost:0', self, {:safe_level => 4})
end
def four
DRbObject.new_with_uri(@four.uri)
end
def remote_class
DRbObject.new(self.class)
end
end
if __FILE__ == $0
def ARGV.shift
it... | Ruby |
require 'runit/testcase'
require 'runit/cui/testrunner'
require 'timerholder'
class TimerHolderTest < RUNIT::TestCase
def do_test(timeout, keeper_sleep = nil)
holder = TimerHolder.new(timeout)
holder.keeper_sleep = keeper_sleep if keeper_sleep
key = holder.add(self)
sleep(timeout * 0.5)
assert_eq... | Ruby |
require "#{File.dirname(File.expand_path(__FILE__))}/ut_drb"
require 'drb/ssl'
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <manager-uri> <name>" unless it
it
end
config = Hash.new
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerifyCallback] = lambda{|ok,x50... | Ruby |
# acltest.rb - ACL unit test
# Copyright (c) 2000 Masatoshi SEKI
#
# acltest.rb is copyrighted free software by Masatoshi SEKI.
# You can redistribute it and/or modify it under the same terms as Ruby.
require 'test/unit'
require 'drb/acl'
class SampleHosts
def initialize
list = %w(127.0.0.1 localhost
... | Ruby |
require 'drbtest'
class TestDRbReusePort < Test::Unit::TestCase
include DRbAry
def setup
@ext = DRbService.ext_service('ut_port.rb')
@there = @ext.front
end
def teardown
return unless @ext
@ext.stop_service
while true
sleep 0.1
begin
@ext.alive?
rescue DRb::DRbCo... | Ruby |
require 'drb/drb'
require 'drb/extserv'
require 'timeout'
class DRbLarge
include DRbUndumped
def size(ary)
ary.size
end
def sum(ary)
sum = 0
ary.each do |e|
sum += e.to_i
end
sum
end
def arg_test(*arg)
# nop
end
end
if __FILE__ == $0
def ARGV.shift
it = super()
... | Ruby |
require 'test/unit'
require 'drb/drb'
require 'drb/extservm'
require 'timeout'
begin
loadpath = $:.dup
$:.replace($: | [File.expand_path("../ruby", File.dirname(__FILE__))])
require 'envutil'
ensure
$:.replace(loadpath)
end
class DRbService
@@manager = DRb::ExtServManager.new
@@ruby = EnvUtil.rubybin
@@r... | Ruby |
require 'drbtest'
begin
require 'drb/ssl'
rescue LoadError
end
if Object.const_defined?("OpenSSL")
class DRbSSLService < DRbService
%w(ut_drb_drbssl.rb ut_array_drbssl.rb).each do |nm|
add_service_command(nm)
end
config = Hash.new
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerify... | Ruby |
require 'drb/drb'
require 'drb/extserv'
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <uri> <name>" unless it
it
end
DRb.start_service('drbunix:', [1, 2, 'III', 4, "five", 6])
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
end
| Ruby |
require 'drb/drb'
require 'drb/extserv'
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <uri> <name>" unless it
it
end
DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6],
{:safe_level => 1})
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DR... | Ruby |
require 'drb/drb'
require 'drb/extserv'
require 'drb/ssl'
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <uri> <name>" unless it
it
end
config = Hash.new
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
true
}
confi... | Ruby |
require 'drb/drb'
require 'drb/extserv'
require 'timeout'
class XArray < Array
def initialize(ary)
ary.each do |x|
self.push(x)
end
end
end
class XArray2 < XArray
include DRbUndumped
end
class Unknown2
def initialize
@foo = 'unknown2'
end
end
class DRbEx
include DRbUndumped
class Fo... | Ruby |
require 'drb/drb'
require 'drb/extserv'
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <uri> <name>" unless it
it
end
DRb.start_service('druby://:8473', [1, 2, 'III', 4, "five", 6])
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
end
| Ruby |
require 'drbtest'
class TestDRbCore < Test::Unit::TestCase
include DRbCore
end
class TestDRbYield < Test::Unit::TestCase
def setup
@ext = DRbService.ext_service('ut_drb.rb')
@there = @ext.front
end
def teardown
@ext.stop_service if @ext
end
def test_01_one
@there.echo_yield_1([]) {|one|
... | Ruby |
require "#{File.dirname(File.expand_path(__FILE__))}/ut_drb"
if __FILE__ == $0
def ARGV.shift
it = super()
raise "usage: #{$0} <manager-uri> <name>" unless it
it
end
DRb::DRbServer.default_argc_limit(8)
DRb::DRbServer.default_load_limit(4096)
DRb.start_service('drbunix:', DRbEx.new)
es = DRb::... | Ruby |
require 'drbtest'
begin
require 'drb/unix'
rescue LoadError
end
if Object.const_defined?("UNIXServer")
class DRbUNIXService < DRbService
%w(ut_drb_drbunix.rb ut_array_drbunix.rb).each do |nm|
add_service_command(nm)
end
uri = ARGV.shift if $0 == __FILE__
@server = DRb::DRbServer.new(uri || 'drbunix:'... | Ruby |
#! /usr/bin/ruby
require 'thread'
class LocalBarrier
def initialize(n)
@wait = Queue.new
@done = Queue.new
@keeper = begin_keeper(n)
end
def sync
@done.push(true)
@wait.pop
end
def join
@keeper.join
end
private
def begin_keeper(n)
Thread.start do
n.times do
... | Ruby |
# -*- ruby-indent-level: 4 -*-
require 'thread'
require 'test/unit'
class TC_Thread < Test::Unit::TestCase
def setup
Thread.abort_on_exception = true
end
def teardown
Thread.abort_on_exception = false
end
def test_condvar
mutex = Mutex.new
condvar = ConditionVariable.new
result = []
mutex.syn... | Ruby |
require 'test/unit'
require 'soap/property'
module SOAP
class TestProperty < Test::Unit::TestCase
FrozenError = (RUBY_VERSION >= "1.9.0") ? RuntimeError : TypeError
def setup
@prop = ::SOAP::Property.new
end
def teardown
# Nothing to do.
end
def test_s_load
propstr = <<__EOP__
# comment1... | Ruby |
require 'test/unit'
require 'soap/httpconfigloader'
require 'soap/rpc/driver'
if defined?(HTTPAccess2)
module SOAP
class TestHTTPConfigLoader < Test::Unit::TestCase
DIR = File.dirname(File.expand_path(__FILE__))
def setup
@client = SOAP::RPC::Driver.new(nil, nil)
end
def test_property
testproperty... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'
require 'soap/attachment'
module SOAP
module SWA
class TestFile < Test::Unit::TestCase
Port = 17171
THIS_FILE = File.expand_path(__FILE__)
class SwAService
def get_file
return {
'name' => $0,
'file' => SOAP::At... | Ruby |
require 'test/unit'
begin
require 'http-access2'
rescue LoadError
end
require 'soap/rpc/driver'
if defined?(HTTPAccess2) and defined?(OpenSSL)
module SOAP; module SSL
class TestSSL < Test::Unit::TestCase
PORT = 17171
DIR = File.dirname(File.expand_path(__FILE__))
require 'rbconfig'
RUBY = File.join(
... | Ruby |
require 'webrick/https'
require 'logger'
require 'rbconfig'
require 'soap/rpc/httpserver'
class HelloWorldServer < SOAP::RPC::HTTPServer
private
def on_init
self.level = Logger::Severity::FATAL
@default_namespace = 'urn:ssltst'
add_method(self, 'hello_world', 'from')
end
def hello_world(from)
... | Ruby |
require 'test/unit'
require 'soap/rpc/httpserver'
require 'soap/rpc/driver'
module SOAP
class TestStyleUse < Test::Unit::TestCase
# rpc driver: obj in(Hash allowed for literal), obj out
#
# style: not visible from user
# rpc: wrapped element
# document: unwrappted element
#
# use:
# ... | Ruby |
require 'test/unit'
require 'soap/baseData'
require 'soap/mapping'
module SOAP
class TestSOAPElement < Test::Unit::TestCase
include SOAP
def setup
# Nothing to do.
end
def teardown
# Nothing to do.
end
def d(elename = nil, text = nil)
elename ||= n(nil, nil)
if text
SOAPElement.... | Ruby |
require 'test/unit'
require 'soap/marshal'
module SOAP
module Marshal
class Node; include SOAP::Marshallable
attr_reader :first, :second, :str
def initialize(*init_next)
@first = init_next[0]
@second = init_next[1]
end
end
class TestDigraph < Test::Unit::TestCase
def setup
@n9 = Node.new
@... | Ruby |
require 'test/unit'
require 'soap/marshal'
dir = File.join(File.dirname(File.expand_path(__FILE__)), '../../ruby')
orgpath = $:.dup
begin
$:.push(dir)
require 'marshaltestlib'
ensure
$:.replace(orgpath)
end
module SOAP
module Marshal
class TestMarshal < Test::Unit::TestCase
include MarshalTestLib
def encode... | Ruby |
require 'test/unit'
require 'soap/marshal'
module SOAP
module Marshal
Foo1 = ::Struct.new("Foo1", :m)
Foo2 = ::Struct.new(:m)
class Foo3
attr_accessor :m
end
class TestStruct < Test::Unit::TestCase
def test_foo1
org = Foo1.new
org.m = org
obj = convert(org)
assert_equal(Foo1, obj.class)
ass... | Ruby |
require 'test/unit'
require 'soap/rpc/standaloneServer'
require 'soap/rpc/driver'
module SOAP; module ASPDotNet
class TestASPDotNet < Test::Unit::TestCase
class Server < ::SOAP::RPC::StandaloneServer
Namespace = "http://localhost/WebService/"
def on_init
add_document_method(
self,
N... | Ruby |
require 'test/unit'
require 'soap/rpc/httpserver'
require 'soap/rpc/driver'
module SOAP; module Struct
class TestStruct < Test::Unit::TestCase
Namespace = "urn:example.com:simpletype-rpc"
class Server < ::SOAP::RPC::HTTPServer
@@test_struct = ::Struct.new(:one, :two)
def on_init
add_method(self, ... | Ruby |
require 'test/unit'
require 'soap/baseData'
module SOAP
class TestSOAP < Test::Unit::TestCase
NegativeZero = (-1.0 / (1.0 / 0.0))
def setup
# Nothing to do.
end
def teardown
# Nothing to do.
end
def assert_parsed_result(klass, str)
o = klass.new(str)
assert_equal(str, o.to_s)
end
... | Ruby |
require 'test/unit'
require 'soap/mapping'
module SOAP
class TestMapping < Test::Unit::TestCase
def test_date
targets = [
["2002-12-31",
"2002-12-31Z"],
["2002-12-31+00:00",
"2002-12-31Z"],
["2002-12-31-00:00",
"2002-12-31Z"],
["-2002-12-31",
"-2002-12-31Z"],
["-2002-12-31+00... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'webrick'
require 'webrick/httpproxy'
require 'logger'
module SOAP
class TestStreamHandler < Test::Unit::TestCase
Port = 17171
ProxyPort = 17172
def setup
@logger = Logger.new(STDERR)
@logger.level = Logger::Severity::ERROR
@url = "http://loca... | Ruby |
#!/usr/bin/env ruby
require 'soap/rpc/standaloneServer'
require 'calc2'
class CalcServer2 < SOAP::RPC::StandaloneServer
def on_init
servant = CalcService2.new
add_method(servant, 'set_value', 'newValue')
add_method(servant, 'get_value')
add_method_as(servant, '+', 'add', 'lhs')
add_method_as(ser... | Ruby |
module CalcService
def self.add(lhs, rhs)
lhs + rhs
end
def self.sub(lhs, rhs)
lhs - rhs
end
def self.multi(lhs, rhs)
lhs * rhs
end
def self.div(lhs, rhs)
lhs / rhs
end
end
| Ruby |
#!/usr/bin/env ruby
require 'soap/rpc/standaloneServer'
require 'calc'
class CalcServer < SOAP::RPC::StandaloneServer
def initialize(*arg)
super
servant = CalcService
add_servant(servant, 'http://tempuri.org/calcService')
end
end
if $0 == __FILE__
status = CalcServer.new('CalcServer', nil, '0.0.0.... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'server2.rb'
module SOAP
module Calc
class TestCalc2 < Test::Unit::TestCase
Port = 17171
def setup
@server = CalcServer2.new('CalcServer', 'http://tempuri.org/calcService', '0.0.0.0', Port)
@server.level = Logger::Severity::ERROR
@t = Thread.new... | Ruby |
class CalcService2
def initialize(value = 0)
@value = value
end
def set_value(value)
@value = value
end
def get_value
@value
end
def +(rhs)
@value + rhs
end
def -(rhs)
@value - rhs
end
def *(rhs)
@value * rhs
end
def /(rhs)
@value / rhs
end
end
| Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'logger'
require 'webrick'
require 'rbconfig'
module SOAP
module Calc
class TestCalcCGI < Test::Unit::TestCase
# This test shuld be run after installing ruby.
RUBYBIN = File.join(
Config::CONFIG["bindir"],
Config::CONFIG["ruby_install_name"] + Config... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'server.rb'
module SOAP
module Calc
class TestCalc < Test::Unit::TestCase
Port = 17171
def setup
@server = CalcServer.new(self.class.name, nil, '0.0.0.0', Port)
@server.level = Logger::Severity::ERROR
@t = Thread.new {
@server.start
}
... | Ruby |
# urn:example.com:simpletype-rpc-type
class Version_struct
@@schema_type = "version_struct"
@@schema_ns = "urn:example.com:simpletype-rpc-type"
attr_accessor :version
attr_accessor :msg
def initialize(version = nil, msg = nil)
@version = version
@msg = msg
end
end
# urn:example.com:simpletype-rpc... | Ruby |
require 'test/unit'
require 'soap/rpc/httpserver'
require 'soap/wsdlDriver'
module SOAP
class TestSimpleType < Test::Unit::TestCase
class Server < ::SOAP::RPC::HTTPServer
def on_init
add_method(self, 'echo_version', 'version')
end
def echo_version(version)
# "2.0" is out of range.
... | Ruby |
require 'test/unit'
require 'soap/rpc/standaloneServer'
require 'soap/wsdlDriver'
module SOAP
class TestDocument < Test::Unit::TestCase
Namespace = 'urn:example.com:document'
class Server < ::SOAP::RPC::StandaloneServer
def on_init
add_document_method(self, 'urn:example.com:document#submit', 'submit'... | Ruby |
require 'test/unit'
require 'soap/rpc/httpserver'
require 'soap/wsdlDriver'
module SOAP
class TestCalc < Test::Unit::TestCase
class Server < ::SOAP::RPC::HTTPServer
def on_init
add_method(self, 'add', 'x', 'y')
end
def add(x, y)
x.to_f + y.to_f
end
end
DIR = File.dirname(File.e... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'webrick'
require 'logger'
module SOAP
class TestEnvelopeNamespace < Test::Unit::TestCase
Port = 17171
TemporaryNamespace = 'urn:foo'
def setup
@logger = Logger.new(STDERR)
@logger.level = Logger::Severity::ERROR
@url = "http://localhost:#{Por... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'
module SOAP
module Fault
class TestCustomFault < Test::Unit::TestCase
Port = 17171
class CustomFaultServer < SOAP::RPC::StandaloneServer
def on_init
add_method(self, 'fault', 'msg')
end
def fault(msg)
SOA... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'
require 'soap/header/simplehandler'
module SOAP
module Header
class TestSimpleHandler < Test::Unit::TestCase
Port = 17171
PortName = 'http://tempuri.org/authHeaderPort'
class PingPortServer < SOAP::RPC::StandaloneServer
cla... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'
require 'soap/header/simplehandler'
module SOAP
module Header
class TestAuthHeader < Test::Unit::TestCase
Port = 17171
PortName = 'http://tempuri.org/authHeaderPort'
MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader",... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'soap/rpc/standaloneServer'
require 'soap/header/simplehandler'
require 'logger'
require 'webrick'
require 'rbconfig'
module SOAP
module Header
class TestAuthHeaderCGI < Test::Unit::TestCase
# This test shuld be run after installing ruby.
RUBYBIN = File.join... | Ruby |
require 'test/unit'
require 'soap/rpc/driver'
require 'hw_s.rb'
module SOAP
module HelloWorld
class TestHelloWorld < Test::Unit::TestCase
Port = 17171
def setup
@server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', Port)
@server.level = Logger::Severity::ERROR
@t = Thread.new {
Thread.c... | Ruby |
require 'soap/rpc/standaloneServer'
class HelloWorldServer < SOAP::RPC::StandaloneServer
def on_init
add_method(self, 'hello_world', 'from')
end
def hello_world(from)
"Hello World, from #{ from }"
end
end
if $0 == __FILE__
server = HelloWorldServer.new('hws', 'urn:hws', '0.0.0.0', 17171)
server.s... | Ruby |
require 'test/unit'
require 'soap/rpc/standaloneServer'
require 'soap/rpc/driver'
if defined?(HTTPAccess2)
module SOAP
class TestNoIndent < Test::Unit::TestCase
Port = 17171
class NopServer < SOAP::RPC::StandaloneServer
def initialize(*arg)
super
add_rpc_method(self, 'nop')
end
def nop... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerSlash < TestCase
def setup
@elements = {
"section" => "articles",
"department" => "not-an-ocean-unless-there-are-lobsters",
"comments" => 177,
"hit_parades" => [177, 155, 105, 33, 6, 3, 0],
}
end... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerAtomFeed < TestCase
def setup
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@dc_elems = {
:title => "hoge",
:description =>
" XML is p... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerITunes < TestCase
def test_setup_maker_simple
author = "John Doe"
block = true
categories = ["Audio Blogs"]
image = "http://example.com/podcasts/everything/AllAboutEverything.jpg"
duration = "4:05"
dura... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerSlash < TestCase
def test_setup_maker
elements = {
"section" => "articles",
"department" => "not-an-ocean-unless-there-are-lobsters",
"comments" => 177,
"hit_parades" => [177, 155, 105, 33, 6, 3, 0],
... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMakerAtomEntry < TestCase
def setup
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@dc_elems = {
:title => "hoge",
:description =>
" XML is ... | Ruby |
require "rss-testcase"
require "rss/atom"
module RSS
class TestParserAtom < TestCase
def test_entry_validation
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<entry/>
EOA
end
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<entry xmlns="hoge"/>
EOA
end
assert_p... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerSyndication < TestCase
def setup
@uri = "http://purl.org/rss/1.0/modules/syndication/"
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@elements = ... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/2.0"
require "rss/itunes"
module RSS
class TestITunes < TestCase
def test_author
assert_itunes_author(%w(channel)) do |content, xmlns|
make_rss20(make_channel20(content), xmlns)
end
assert_itunes_author(%w(ite... | Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/maker"
require "rss/1.0"
require "rss/2.0"
require "rss/content"
require "rss/dublincore"
require "rss/syndication"
require "rss/trackback"
module RSS
class TestToS < TestCase
def setup
@image_url = "http://example.com/foo.png"
@textinput... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMaker20 < TestCase
def test_rss
rss = RSS::Maker.make("2.0")
assert_nil(rss)
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
end
assert_equal("2.0", rss.rss_version)
rss ... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMaker09 < TestCase
def test_rss
rss = RSS::Maker.make("0.91")
assert_nil(rss)
rss = RSS::Maker.make("0.9") do |maker|
setup_dummy_channel(maker)
setup_dummy_image(maker)
end
assert_equal("0.92",... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerDublinCore < TestCase
def setup
@uri = "http://purl.org/dc/elements/1.1/"
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@elements = {
:ti... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMaker10 < TestCase
def test_rdf
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
end
assert_equal("1.0", rss.rss_version)
rss = RSS::Maker.make("1.0") do |mak... | Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/xml-stylesheet"
module RSS
class TestXMLStyleSheet < TestCase
def test_accessor
[
{:href => "a.xsl", :type => "text/xsl"},
{:media => "print", :title => "FOO"},
{:charset => "UTF-8", :alternate => ... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMaker10 < TestCase
def setup
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
@dc_elems = {
:title => "hoge",
:description =>
" XML is ... | Ruby |
require "fileutils"
require "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
module RSS
class TestParser < TestCase
def setup
@_default_parser = Parser.default_parser
@rss10 = make_RDF(<<-EOR)
#{make_channel}
#{make_item}
#{make_textinput}
#{make_image}
EOR
@rss_file = "rss10.rdf"
... | Ruby |
require "rss-testcase"
require "rss/atom"
module RSS
class TestParserAtomFeed < TestCase
def test_feed_validation
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<feed/>
EOA
end
assert_ns("", Atom::URI) do
Parser.parse(<<-EOA)
<feed xmlns="hoge"/>
EOA
end
assert_... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMaker20 < TestCase
def test_setup_maker_channel
title = "fugafuga"
link = "http://hoge.com"
description = "fugafugafugafuga"
language = "ja"
copyright = "foo"
managingEditor = "bar"
webMaster = "web m... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestSetupMaker09 < TestCase
def test_setup_maker_channel
title = "fugafuga"
link = "http://hoge.com"
description = "fugafugafugafuga"
language = "ja"
copyright = "foo"
managingEditor = "bar"
webMaster = "web m... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/dublincore"
module RSS
class TestDublinCore < TestCase
def setup
@rss10_parents = [%w(channel), %w(image), %w(item), %w(textinput)]
@rss10_source = make_RDF(<<-EOR, {DC_PREFIX => DC_URI})
#{make_channel(D... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/slash"
module RSS
class TestSlash < TestCase
def setup
@elements = {
"section" => "articles",
"department" => "not-an-ocean-unless-there-are-lobsters",
"comments" => 177,
"hit_para... | Ruby |
require "erb"
require "test/unit"
require 'rss-assertions'
require "rss"
module RSS
class TestCase < Test::Unit::TestCase
include ERB::Util
include RSS
include Assertions
XMLDECL_VERSION = "1.0"
XMLDECL_ENCODING = "UTF-8"
XMLDECL_STANDALONE = "no"
RDF_ABOUT = "http://www.xml.com/xml/... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerITunes < TestCase
def test_author
assert_maker_itunes_author(%w(channel))
assert_maker_itunes_author(%w(items last))
end
def test_block
assert_maker_itunes_block(%w(channel))
assert_maker_itunes_block(%w(items ... | Ruby |
require "rss-testcase"
module RSS
class TestVersion < TestCase
def test_version
assert_equal("0.2.4", ::RSS::VERSION)
end
end
end
| Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerTaxonomy < TestCase
def setup
@uri = "http://purl.org/rss/1.0/modules/taxonomy/"
@resources = [
"http://meerkat.oreillynet.com/?c=cat23",
"http://meerkat.oreillynet.com/?c=47",
"http://dmoz.org/Compu... | Ruby |
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
module RSS
class TestRSS10Core < TestCase
def setup
@rdf_prefix = "rdf"
@rdf_uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@uri = "http://purl.org/rss/1.0/"
end
def test_RDF
version = "1.0"
e... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerXMLStyleSheet < TestCase
def test_xml_stylesheet
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
media = 'printer'
charset = 'UTF-8'
alternate = 'yes'
rss = RSS::Maker.make("1.0") do |maker|
... | Ruby |
require "rss-testcase"
require "rss/1.0"
module RSS
class TestInherit < TestCase
class InheritedImage < RSS::RDF::Image
def self.indent_size; 1; end
def self.tag_name; 'image'; end
end
def setup
@rss = make_RDF(<<-EOR)
#{make_channel}
#{make_image}
#{make_item}
#{make_textinput}
EOR
... | Ruby |
require "cgi"
require "rexml/document"
require "rss-testcase"
require "rss/1.0"
require "rss/image"
module RSS
class TestImage < TestCase
def setup
@prefix = "image"
@uri = "http://purl.org/rss/1.0/modules/image/"
@favicon_attrs = {
"rdf:about" => "http://www.kuro5hin.org/favicon.ic... | Ruby |
require "rss-testcase"
require "rss/maker"
module RSS
class TestMakerAtomFeed < TestCase
def test_root_element
feed = Maker.make("atom") do |maker|
setup_dummy_channel_atom(maker)
end
assert_equal(["atom", "1.0", "feed"], feed.feed_info)
feed = Maker.make("atom") do |maker|
... | Ruby |
require "rss-testcase"
require "rss/2.0"
module RSS
class TestParser20 < TestCase
def test_rss20
assert_parse(make_rss20(<<-EOR), :missing_tag, "channel", "rss")
EOR
assert_parse(make_rss20(<<-EOR), :nothing_raised)
#{make_channel20("")}
EOR
end
def test_cloud20
attrs = [
["d... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.