xx 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xx-0.1.0.rb +728 -0
- data/lib/xx.rb +728 -0
- data/test/xx.rb +52 -0
- metadata +46 -0
data/test/xx.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
#
|
3
|
+
# global setup
|
4
|
+
#
|
5
|
+
$VERBOSE = nil
|
6
|
+
STDOUT.sync = true
|
7
|
+
STDERR.reopen STDOUT
|
8
|
+
%w( lib ../lib . ).each{|d| $:.unshift d}
|
9
|
+
#
|
10
|
+
# load any libs
|
11
|
+
#
|
12
|
+
dirname, basename = File::split __FILE__
|
13
|
+
libdir = File::expand_path(File::join(dirname, File::join("..", "lib")))
|
14
|
+
glob = File::join libdir, "*{.rb,.so}"
|
15
|
+
Dir[glob].each{|f| require(File::expand_path(f))}
|
16
|
+
#
|
17
|
+
# find sample and expected dirs
|
18
|
+
#
|
19
|
+
sampledir = File::expand_path(File::join(dirname, File::join("..", "sample")))
|
20
|
+
expecteddir = File::join sampledir, "expected"
|
21
|
+
#
|
22
|
+
# this tests everything in samples/* and compares against samples/expected/*
|
23
|
+
#
|
24
|
+
Class::new(Test::Unit::TestCase) do
|
25
|
+
def setup; end
|
26
|
+
|
27
|
+
samples = Dir[File::join(sampledir, "*")].select{|entry| test ?f, entry}
|
28
|
+
|
29
|
+
test_nn = "test_sample_00"
|
30
|
+
|
31
|
+
sample_output_expected = lambda do |sample, expected|
|
32
|
+
lambda do
|
33
|
+
actual = IO::popen("ruby -I#{ libdir } #{ sample } 2>&1"){|pipe| pipe.read}
|
34
|
+
expected = IO::read expected
|
35
|
+
begin
|
36
|
+
actual_doc = ::REXML::Document::new actual
|
37
|
+
expected_doc = ::REXML::Document::new expected
|
38
|
+
assert_equal actual_doc.to_s, expected_doc.to_s
|
39
|
+
rescue Exception
|
40
|
+
assert_equal actual.to_s, expected.to_s
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
samples.each do |sample|
|
46
|
+
dirname, basename = File::split sample
|
47
|
+
expected = File::join expecteddir, basename
|
48
|
+
next unless test ?e, sample and test ?e, expected
|
49
|
+
define_method(test_nn, sample_output_expected[sample, expected])
|
50
|
+
test_nn.succ!
|
51
|
+
end
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: xx
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2006-01-24 00:00:00 -07:00
|
8
|
+
summary: xx
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: ara.t.howard@noaa.gov
|
12
|
+
homepage: http://codeforpeople.com/lib/ruby/xx/
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire: xx
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Ara T. Howard
|
30
|
+
files:
|
31
|
+
- lib/xx-0.1.0.rb
|
32
|
+
- lib/xx.rb
|
33
|
+
test_files:
|
34
|
+
- test/xx.rb
|
35
|
+
rdoc_options: []
|
36
|
+
|
37
|
+
extra_rdoc_files: []
|
38
|
+
|
39
|
+
executables: []
|
40
|
+
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
requirements: []
|
44
|
+
|
45
|
+
dependencies: []
|
46
|
+
|