union 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +4 -0
- data/Gemfile +6 -0
- data/MANIFEST +2 -1
- data/Rakefile +4 -6
- data/lib/union.rb +1 -1
- data/spec/union_spec.rb +50 -0
- data/union.gemspec +4 -2
- metadata +24 -9
- metadata.gz.sig +0 -0
- data/test/test_union.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a619aec0c27be52603178e89364bd85c3dab620ec47971220b75acae15bcca37
|
4
|
+
data.tar.gz: fa3c3681e2455953b0da6501a88bb28ff19df7364fef68d4a02a0f9127db218e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcd3b0684e8d0d278afd1262729828ee85041d42249801206ce7f9de16f6244dfcf5d55e9fbc0bb5500853653c3680f6b361f62ffc136a25389343b5f0bf8678
|
7
|
+
data.tar.gz: f95468cadcb0b680fd240034d97c1c51cc9a89ec87976f72a5af3da83c2b4ab46ce59a2683f67afd499ac05f5995e7d72849c9d27637e6b917a0dd9a192ed7f6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
data/Gemfile
ADDED
data/MANIFEST
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/clean'
|
3
|
-
require '
|
3
|
+
require 'rspec/core/rake_task'
|
4
4
|
|
5
5
|
CLEAN.include("**/*.gem", "**/*.rbc", "**/*.rbx")
|
6
6
|
|
@@ -19,9 +19,7 @@ namespace :gem do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
t.warning = true
|
25
|
-
end
|
22
|
+
desc "Run the test suite"
|
23
|
+
RSpec::Core::RakeTask.new(:spec)
|
26
24
|
|
27
|
-
task :default => :
|
25
|
+
task :default => :spec
|
data/lib/union.rb
CHANGED
data/spec/union_spec.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'union'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
RSpec.describe Union do
|
5
|
+
before(:all) do
|
6
|
+
described_class.new('Human', :name, :age, :height)
|
7
|
+
end
|
8
|
+
|
9
|
+
before do
|
10
|
+
@union = Union::Human.new
|
11
|
+
end
|
12
|
+
|
13
|
+
example "union_version" do
|
14
|
+
expect(Union::VERSION).to eq('1.2.0')
|
15
|
+
expect(Union::VERSION).to be_frozen
|
16
|
+
end
|
17
|
+
|
18
|
+
example "union_constructor" do
|
19
|
+
expect{ Union::Human.new('Matz') }.to raise_error(ArgumentError)
|
20
|
+
end
|
21
|
+
|
22
|
+
example "union_attribute_assignment_basic" do
|
23
|
+
expect{ @union.name = 'Daniel' }.not_to raise_error
|
24
|
+
expect(@union.name).to eq('Daniel')
|
25
|
+
end
|
26
|
+
|
27
|
+
example "union_attribute_assignment_by_method_name" do
|
28
|
+
expect{ @union.name = 'Daniel' }.not_to raise_error
|
29
|
+
expect{ @union.age = 38 }.not_to raise_error
|
30
|
+
expect(@union.name).to be_nil
|
31
|
+
expect(@union.height).to be_nil
|
32
|
+
expect(@union.age).to eq(38)
|
33
|
+
end
|
34
|
+
|
35
|
+
example "union_attribute_assignment_by_string_ref" do
|
36
|
+
expect{ @union['name'] = 'Daniel' }.not_to raise_error
|
37
|
+
expect{ @union['age'] = 38 }.not_to raise_error
|
38
|
+
expect(@union['name']).to be_nil
|
39
|
+
expect(@union['height']).to be_nil
|
40
|
+
expect(@union['age']).to eq(38)
|
41
|
+
end
|
42
|
+
|
43
|
+
example "union_attribute_assignment_by_symbol_ref" do
|
44
|
+
expect{ @union[:name] = 'Daniel' }.not_to raise_error
|
45
|
+
expect{ @union[:age] = 38 }.not_to raise_error
|
46
|
+
expect(@union[:name]).to be_nil
|
47
|
+
expect(@union[:height]).to be_nil
|
48
|
+
expect(@union[:age]).to eq(38)
|
49
|
+
end
|
50
|
+
end
|
data/union.gemspec
CHANGED
@@ -2,18 +2,20 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'union'
|
5
|
-
spec.version = '1.
|
5
|
+
spec.version = '1.2.0'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.license = 'Apache-2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
9
9
|
spec.homepage = 'https://github.com/djberg96/union'
|
10
10
|
spec.summary = 'A struct-like C union for Ruby'
|
11
|
-
spec.test_file = '
|
11
|
+
spec.test_file = 'spec/union_spec.rb'
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
13
|
spec.cert_chain = Dir['certs/*']
|
14
14
|
|
15
15
|
spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
16
|
+
|
16
17
|
spec.add_development_dependency('rake')
|
18
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
17
19
|
|
18
20
|
spec.metadata = {
|
19
21
|
'homepage_uri' => 'https://github.com/djberg96/union',
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: union
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date:
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rake
|
@@ -51,6 +51,20 @@ dependencies:
|
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rspec
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.9'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.9'
|
54
68
|
description: |2
|
55
69
|
The union library provides an analog to a C/C++ union for Ruby.
|
56
70
|
In this implementation a union is a kind of struct where multiple
|
@@ -65,10 +79,10 @@ extra_rdoc_files:
|
|
65
79
|
- MANIFEST
|
66
80
|
files:
|
67
81
|
- LICENSE
|
68
|
-
- test
|
69
|
-
- test/test_union.rb
|
70
82
|
- CHANGES
|
71
83
|
- MANIFEST
|
84
|
+
- spec
|
85
|
+
- spec/union_spec.rb
|
72
86
|
- union.gemspec
|
73
87
|
- README
|
74
88
|
- Rakefile
|
@@ -76,6 +90,7 @@ files:
|
|
76
90
|
- certs/djberg96_pub.pem
|
77
91
|
- lib
|
78
92
|
- lib/union.rb
|
93
|
+
- Gemfile
|
79
94
|
homepage: https://github.com/djberg96/union
|
80
95
|
licenses:
|
81
96
|
- Apache-2.0
|
@@ -86,7 +101,7 @@ metadata:
|
|
86
101
|
documentation_uri: https://github.com/djberg96/union/wiki
|
87
102
|
source_code_uri: https://github.com/djberg96/union
|
88
103
|
wiki_uri: https://github.com/djberg96/union/wiki
|
89
|
-
post_install_message:
|
104
|
+
post_install_message:
|
90
105
|
rdoc_options: []
|
91
106
|
require_paths:
|
92
107
|
- lib
|
@@ -101,9 +116,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
116
|
- !ruby/object:Gem::Version
|
102
117
|
version: '0'
|
103
118
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
105
|
-
signing_key:
|
119
|
+
rubygems_version: 3.1.4
|
120
|
+
signing_key:
|
106
121
|
specification_version: 4
|
107
122
|
summary: A struct-like C union for Ruby
|
108
123
|
test_files:
|
109
|
-
-
|
124
|
+
- spec/union_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/test/test_union.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'union'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
class TC_Union < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
Union.new('Human', :name, :age, :height) unless defined? Union::Human
|
7
|
-
@union = Union::Human.new
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_union_version
|
11
|
-
assert_equal('1.1.0', Union::VERSION)
|
12
|
-
assert_true(Union::VERSION.frozen?)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_union_constructor
|
16
|
-
assert_raise(ArgumentError){ Union::Human.new('Matz') }
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_union_attribute_assignment_basic
|
20
|
-
assert_nothing_raised{ @union.name = 'Daniel' }
|
21
|
-
assert_equal('Daniel', @union.name)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_union_attribute_assignment_by_method_name
|
25
|
-
assert_nothing_raised{ @union.name = 'Daniel' }
|
26
|
-
assert_nothing_raised{ @union.age = 38 }
|
27
|
-
assert_nil(@union.name)
|
28
|
-
assert_nil(@union.height)
|
29
|
-
assert_equal(38, @union.age)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_union_attribute_assignment_by_string_ref
|
33
|
-
assert_nothing_raised{ @union['name'] = 'Daniel' }
|
34
|
-
assert_nothing_raised{ @union['age'] = 38 }
|
35
|
-
assert_nil(@union['name'])
|
36
|
-
assert_nil(@union['height'])
|
37
|
-
assert_equal(38, @union['age'])
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_union_attribute_assignment_by_symbol_ref
|
41
|
-
assert_nothing_raised{ @union[:name] = 'Daniel' }
|
42
|
-
assert_nothing_raised{ @union[:age] = 38 }
|
43
|
-
assert_nil(@union[:name])
|
44
|
-
assert_nil(@union[:height])
|
45
|
-
assert_equal(38, @union[:age])
|
46
|
-
end
|
47
|
-
|
48
|
-
def teardown
|
49
|
-
@union = nil
|
50
|
-
end
|
51
|
-
end
|