comp_tree 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.rdoc +5 -0
- data/MANIFEST +26 -0
- data/devel/jumpstart.rb +634 -1
- data/lib/comp_tree/driver.rb +14 -6
- data/lib/comp_tree/error.rb +3 -0
- data/lib/comp_tree/node.rb +1 -1
- data/lib/comp_tree.rb +1 -1
- data/test/test_exception.rb +22 -6
- data/test/test_throw.rb +22 -0
- metadata +8 -5
- data/devel/jumpstart/jumpstart.rb +0 -606
data/lib/comp_tree/node.rb
CHANGED
@@ -101,7 +101,7 @@ module CompTree
|
|
101
101
|
begin
|
102
102
|
unless @function
|
103
103
|
raise NoFunctionError,
|
104
|
-
"
|
104
|
+
"no function was defined for node `#{@name.inspect}'"
|
105
105
|
end
|
106
106
|
@result = @function.call(*@children_results)
|
107
107
|
@computed = true
|
data/lib/comp_tree.rb
CHANGED
data/test/test_exception.rb
CHANGED
@@ -57,12 +57,28 @@ class TestException < Test::Unit::TestCase
|
|
57
57
|
def test_num_threads
|
58
58
|
CompTree.build do |driver|
|
59
59
|
driver.define(:root) { }
|
60
|
-
|
61
|
-
assert_raises(
|
62
|
-
assert_raises(
|
63
|
-
assert_raises(
|
64
|
-
assert_raises(
|
65
|
-
assert_raises(
|
60
|
+
error = CompTree::ArgumentError
|
61
|
+
assert_raises(error) { driver.compute(:root, 0) }
|
62
|
+
assert_raises(error) { driver.compute(:root, :threads => 0) }
|
63
|
+
assert_raises(error) { driver.compute(:root, -1) }
|
64
|
+
assert_raises(error) { driver.compute(:root, :threads => -1) }
|
65
|
+
assert_raises(error) { driver.compute(:root, -11) }
|
66
|
+
assert_raises(error) { driver.compute(:root, :threads => -11) }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_invalid_node
|
71
|
+
CompTree.build do |driver|
|
72
|
+
driver.define(:root) { }
|
73
|
+
assert_nothing_raised {
|
74
|
+
driver.compute(:root, 33)
|
75
|
+
}
|
76
|
+
assert_raises(CompTree::ArgumentError) {
|
77
|
+
driver.compute(:a, 33)
|
78
|
+
}
|
79
|
+
assert_raises(CompTree::ArgumentError) {
|
80
|
+
driver.compute(nil, 33)
|
81
|
+
}
|
66
82
|
end
|
67
83
|
end
|
68
84
|
end
|
data/test/test_throw.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/common'
|
2
|
+
|
3
|
+
class TestThrow < Test::Unit::TestCase
|
4
|
+
EXPECTED = RUBY_VERSION >= "1.9.0" ? ArgumentError : ThreadError
|
5
|
+
|
6
|
+
def test_throw
|
7
|
+
assert_equal 1, Thread.list.size
|
8
|
+
exception = assert_raises(EXPECTED) {
|
9
|
+
CompTree.build do |driver|
|
10
|
+
driver.define(:root, :a) {
|
11
|
+
loop { }
|
12
|
+
}
|
13
|
+
driver.define(:a) {
|
14
|
+
throw :outta_here
|
15
|
+
}
|
16
|
+
driver.compute(:root, 10)
|
17
|
+
end
|
18
|
+
}
|
19
|
+
assert_match "uncaught", exception.message
|
20
|
+
assert_equal 1, Thread.list.size
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comp_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James M. Lawrence
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,10 +24,10 @@ extra_rdoc_files:
|
|
24
24
|
- README.rdoc
|
25
25
|
files:
|
26
26
|
- CHANGES.rdoc
|
27
|
+
- MANIFEST
|
27
28
|
- README.rdoc
|
28
29
|
- Rakefile
|
29
30
|
- devel/jumpstart.rb
|
30
|
-
- devel/jumpstart/jumpstart.rb
|
31
31
|
- devel/jumpstart/lazy_attribute.rb
|
32
32
|
- devel/jumpstart/ruby.rb
|
33
33
|
- devel/jumpstart/simple_installer.rb
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- test/test_flood.rb
|
49
49
|
- test/test_grind.rb
|
50
50
|
- test/test_sequential.rb
|
51
|
+
- test/test_throw.rb
|
51
52
|
has_rdoc: true
|
52
53
|
homepage: http://comptree.rubyforge.org
|
53
54
|
post_install_message:
|
@@ -59,14 +60,14 @@ rdoc_options:
|
|
59
60
|
- --exclude
|
60
61
|
- CHANGES.rdoc
|
61
62
|
- --exclude
|
63
|
+
- MANIFEST
|
64
|
+
- --exclude
|
62
65
|
- README.rdoc
|
63
66
|
- --exclude
|
64
67
|
- Rakefile
|
65
68
|
- --exclude
|
66
69
|
- devel/jumpstart.rb
|
67
70
|
- --exclude
|
68
|
-
- devel/jumpstart/jumpstart.rb
|
69
|
-
- --exclude
|
70
71
|
- devel/jumpstart/lazy_attribute.rb
|
71
72
|
- --exclude
|
72
73
|
- devel/jumpstart/ruby.rb
|
@@ -100,6 +101,8 @@ rdoc_options:
|
|
100
101
|
- test/test_grind.rb
|
101
102
|
- --exclude
|
102
103
|
- test/test_sequential.rb
|
104
|
+
- --exclude
|
105
|
+
- test/test_throw.rb
|
103
106
|
require_paths:
|
104
107
|
- lib
|
105
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|