filigree 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/Rakefile +16 -12
- data/lib/filigree.rb +1 -1
- data/lib/filigree/abstract_class.rb +2 -2
- data/lib/filigree/application.rb +4 -9
- data/lib/filigree/boolean.rb +24 -21
- data/lib/filigree/class.rb +32 -29
- data/lib/filigree/class_methods_module.rb +4 -4
- data/lib/filigree/commands.rb +8 -6
- data/lib/filigree/configuration.rb +6 -8
- data/lib/filigree/match.rb +174 -163
- data/lib/filigree/object.rb +14 -11
- data/lib/filigree/request_file.rb +4 -4
- data/lib/filigree/string.rb +30 -28
- data/lib/filigree/types.rb +9 -10
- data/lib/filigree/version.rb +2 -2
- data/lib/filigree/visitor.rb +5 -5
- data/test/tc_abstract_class.rb +1 -1
- data/test/tc_application.rb +5 -5
- data/test/tc_boolean.rb +4 -1
- data/test/tc_class.rb +10 -6
- data/test/tc_class_methods_module.rb +1 -1
- data/test/tc_commands.rb +4 -4
- data/test/tc_configuration.rb +3 -3
- data/test/tc_match.rb +22 -22
- data/test/tc_object.rb +6 -7
- data/test/tc_string.rb +6 -4
- data/test/tc_types.rb +19 -19
- data/test/tc_visitor.rb +6 -4
- data/test/ts_filigree.rb +5 -5
- metadata +14 -15
data/test/tc_object.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Author:
|
2
|
-
# Project:
|
3
|
-
# Date:
|
4
|
-
# Description:
|
1
|
+
# Author: Chris Wailes <chris.wailes+filigree@gmail.com>
|
2
|
+
# Project: Filigree
|
3
|
+
# Date: 2013/05/04
|
4
|
+
# Description: Test cases for the Object extensions.
|
5
5
|
|
6
6
|
############
|
7
7
|
# Requires #
|
@@ -18,11 +18,10 @@ require 'filigree/object'
|
|
18
18
|
#######################
|
19
19
|
|
20
20
|
class ObjectTester < Minitest::Test
|
21
|
-
Foo = Struct.new :a, :b
|
22
21
|
|
23
|
-
|
22
|
+
using Filigree
|
24
23
|
|
25
|
-
|
24
|
+
Foo = Struct.new :a, :b
|
26
25
|
|
27
26
|
def test_returning
|
28
27
|
assert( returning(true) { false } )
|
data/test/tc_string.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Author:
|
2
|
-
# Project:
|
3
|
-
# Date:
|
4
|
-
# Description:
|
1
|
+
# Author: Chris Wailes <chris.wailes+filigree@gmail.com>
|
2
|
+
# Project: Filigree
|
3
|
+
# Date: 2014/02/05
|
4
|
+
# Description: Test cases for the String extensions.
|
5
5
|
|
6
6
|
############
|
7
7
|
# Requires #
|
@@ -19,6 +19,8 @@ require 'filigree/string'
|
|
19
19
|
|
20
20
|
class ObjectTester < Minitest::Test
|
21
21
|
|
22
|
+
using Filigree
|
23
|
+
|
22
24
|
ORIGINAL = 'Hello, I am a test string. I am really long so that the string segmentation code can be tested.'
|
23
25
|
SEGMENTED = <<eos
|
24
26
|
Hello, I am a test string.
|
data/test/tc_types.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Author: Chris Wailes <chris.wailes@gmail.com>
|
1
|
+
# Author: Chris Wailes <chris.wailes+filigree@gmail.com>
|
2
2
|
# Project: Filigree
|
3
3
|
# Date: 2013/05/04
|
4
4
|
# Description: Test cases for type checking.
|
@@ -40,7 +40,7 @@ class TypeTester < Minitest::Test
|
|
40
40
|
include Filigree::TypedClass
|
41
41
|
|
42
42
|
typed_ivar :foo, Integer
|
43
|
-
typed_ivar :bar, String, true
|
43
|
+
typed_ivar :bar, String, nillable: true
|
44
44
|
|
45
45
|
default_constructor
|
46
46
|
end
|
@@ -61,42 +61,42 @@ class TypeTester < Minitest::Test
|
|
61
61
|
def test_check_type
|
62
62
|
assert check_type([], Array)
|
63
63
|
|
64
|
-
assert check_type(1,
|
65
|
-
assert check_type(nil,
|
66
|
-
assert check_type(1,
|
67
|
-
assert check_type(nil,
|
68
|
-
assert check_type(1, Integer)
|
64
|
+
assert check_type(1, Integer)
|
65
|
+
assert check_type(nil, Integer, nillable: true).nil?
|
66
|
+
assert check_type(1, Integer, strict: true)
|
67
|
+
assert check_type(nil, Integer, nillable: true, strict: true).nil?
|
69
68
|
|
70
|
-
assert_raises(TypeError) { check_type(1,
|
69
|
+
assert_raises(TypeError) { check_type(1, Numeric, strict: true) }
|
71
70
|
assert_raises(TypeError) { check_type(1, Array) }
|
72
71
|
end
|
73
72
|
|
74
73
|
def test_check_array_type
|
75
|
-
assert check_array_type([1, 2, 3],
|
76
|
-
assert check_array_type([1, 2, 3
|
77
|
-
assert check_array_type([1, 2, 3],
|
78
|
-
|
79
|
-
|
80
|
-
assert_raises(TypeError) { check_array_type([1,
|
81
|
-
assert_raises(TypeError) { check_array_type([1,
|
74
|
+
assert check_array_type([1, 2, 3], Integer)
|
75
|
+
assert check_array_type([1, 2, 3, nil], Integer, nillable: true)
|
76
|
+
assert check_array_type([1, 2, 3], Integer, strict: true)
|
77
|
+
assert check_array_type([1, 2, 3, nil], Integer, nillable: true, strict: true)
|
78
|
+
|
79
|
+
assert_raises(TypeError) { check_array_type([1, 2, 3], Numeric, strict: true) }
|
80
|
+
assert_raises(TypeError) { check_array_type([1, :hello, 'world'], Integer) }
|
81
|
+
assert_raises(TypeError) { check_array_type([1, 2, 3], Float, blame: 'foo') }
|
82
82
|
end
|
83
83
|
|
84
84
|
def test_default_constructor
|
85
85
|
v0 = Bar.new(1, 'hello')
|
86
86
|
|
87
|
-
assert_equal 1,
|
87
|
+
assert_equal 1, v0.foo
|
88
88
|
assert_equal 'hello', v0.bar
|
89
89
|
|
90
90
|
v1 = Baf.new(2)
|
91
91
|
|
92
92
|
assert_equal 2, v1.foo
|
93
|
-
assert_nil
|
93
|
+
assert_nil v1.bar
|
94
94
|
|
95
95
|
assert_raises(ArgumentError) { Baz.new(3) }
|
96
96
|
|
97
97
|
v2 = Baz.new(2, 'world')
|
98
98
|
|
99
|
-
assert_equal 2,
|
99
|
+
assert_equal 2, v2.foo
|
100
100
|
assert_equal 'world', v2.bar
|
101
101
|
end
|
102
102
|
|
@@ -107,7 +107,7 @@ class TypeTester < Minitest::Test
|
|
107
107
|
v0.bar = 'hello'
|
108
108
|
v0.baf = [1,2,3]
|
109
109
|
|
110
|
-
assert_equal 1,
|
110
|
+
assert_equal 1, v0.foo
|
111
111
|
assert_equal 'hello', v0.bar
|
112
112
|
assert_equal [1,2,3], v0.baf
|
113
113
|
|
data/test/tc_visitor.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Author: Chris Wailes <chris.wailes@gmail.com>
|
1
|
+
# Author: Chris Wailes <chris.wailes+filigree@gmail.com>
|
2
2
|
# Project: Filigree
|
3
3
|
# Date: 2014/02/11
|
4
4
|
# Description: Test cases for the Visitor module.
|
@@ -19,6 +19,8 @@ require 'filigree/visitor'
|
|
19
19
|
|
20
20
|
class VisitorTester < Minitest::Test
|
21
21
|
|
22
|
+
using Filigree
|
23
|
+
|
22
24
|
####################
|
23
25
|
# Internal Classes #
|
24
26
|
####################
|
@@ -86,7 +88,7 @@ class VisitorTester < Minitest::Test
|
|
86
88
|
two
|
87
89
|
end
|
88
90
|
|
89
|
-
on
|
91
|
+
on(/three/) do
|
90
92
|
:three
|
91
93
|
end
|
92
94
|
|
@@ -124,7 +126,7 @@ class VisitorTester < Minitest::Test
|
|
124
126
|
@total = 0
|
125
127
|
end
|
126
128
|
|
127
|
-
on(Foo.(
|
129
|
+
on(Foo.(Integer.as n)) do
|
128
130
|
@total += n
|
129
131
|
end
|
130
132
|
end
|
@@ -138,7 +140,7 @@ class VisitorTester < Minitest::Test
|
|
138
140
|
@total = 1
|
139
141
|
end
|
140
142
|
|
141
|
-
on(Foo.(
|
143
|
+
on(Foo.(Integer.as n)) do
|
142
144
|
@total *= n
|
143
145
|
end
|
144
146
|
end
|
data/test/ts_filigree.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# Author:
|
2
|
-
# Project:
|
3
|
-
# Date:
|
4
|
-
# Description:
|
5
|
-
#
|
1
|
+
# Author: Chris Wailes <chris.wailes+filigree@gmail.com>
|
2
|
+
# Project: Filigree
|
3
|
+
# Date: 2013/04/19
|
4
|
+
# Description: This file contains the test suit for Filigree. It requires the
|
5
|
+
# individual tests from their respective files.
|
6
6
|
|
7
7
|
############
|
8
8
|
# Requires #
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filigree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wailes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
159
|
+
version: 0.9.9
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
166
|
+
version: 0.9.9
|
167
167
|
description: Filigree provides new classes and extensions to core library classes
|
168
168
|
that add functionality to Ruby.
|
169
169
|
email: chris.wailes+filigree@gmail.com
|
@@ -215,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
215
|
requirements:
|
216
216
|
- - ">="
|
217
217
|
- !ruby/object:Gem::Version
|
218
|
-
version: 2.
|
218
|
+
version: 2.4.0
|
219
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
220
|
requirements:
|
221
221
|
- - ">="
|
@@ -223,22 +223,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
requirements: []
|
225
225
|
rubyforge_project:
|
226
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.6.13
|
227
227
|
signing_key:
|
228
228
|
specification_version: 4
|
229
229
|
summary: Extra functionality for Ruby.
|
230
230
|
test_files:
|
231
|
-
- test/
|
231
|
+
- test/tc_boolean.rb
|
232
|
+
- test/tc_object.rb
|
232
233
|
- test/tc_types.rb
|
233
|
-
- test/
|
234
|
+
- test/tc_configuration.rb
|
235
|
+
- test/tc_commands.rb
|
234
236
|
- test/tc_string.rb
|
235
|
-
- test/tc_application.rb
|
236
|
-
- test/tc_match.rb
|
237
237
|
- test/tc_abstract_class.rb
|
238
|
-
- test/tc_object.rb
|
239
|
-
- test/tc_class_methods_module.rb
|
240
|
-
- test/tc_configuration.rb
|
241
|
-
- test/tc_boolean.rb
|
242
238
|
- test/tc_visitor.rb
|
239
|
+
- test/tc_class_methods_module.rb
|
240
|
+
- test/tc_match.rb
|
241
|
+
- test/tc_class.rb
|
242
|
+
- test/tc_application.rb
|
243
243
|
- test/ts_filigree.rb
|
244
|
-
has_rdoc:
|