ruby-version 0.3.1 → 0.4.2
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.
- data/.travis.yml +16 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +25 -8
- data/LICENSE.txt +1 -1
- data/README.md +14 -3
- data/Rakefile +13 -2
- data/VERSION +1 -1
- data/lib/ruby-version.rb +31 -1
- data/ruby-version.gemspec +21 -14
- data/tests.rb +133 -0
- metadata +65 -16
- data/test +0 -44
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -5,7 +5,9 @@ source "http://rubygems.org"
|
|
5
5
|
# Add dependencies to develop your gem here.
|
6
6
|
# Include everything needed to run rake, tests, features, etc.
|
7
7
|
group :development do
|
8
|
-
gem "bundler"
|
9
|
-
gem "jeweler"
|
10
|
-
gem "
|
8
|
+
gem "bundler"
|
9
|
+
gem "jeweler"
|
10
|
+
gem "rake"
|
11
|
+
gem "rspec"
|
12
|
+
gem "simplecov"
|
11
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,37 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
diff-lcs (1.1.3)
|
4
5
|
git (1.2.5)
|
5
|
-
jeweler (1.
|
6
|
+
jeweler (1.8.4)
|
6
7
|
bundler (~> 1.0)
|
7
8
|
git (>= 1.2.5)
|
8
9
|
rake
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
rdoc
|
11
|
+
json (1.7.5)
|
12
|
+
multi_json (1.3.6)
|
13
|
+
rake (0.9.2.2)
|
14
|
+
rdoc (3.12)
|
15
|
+
json (~> 1.4)
|
16
|
+
rspec (2.11.0)
|
17
|
+
rspec-core (~> 2.11.0)
|
18
|
+
rspec-expectations (~> 2.11.0)
|
19
|
+
rspec-mocks (~> 2.11.0)
|
20
|
+
rspec-core (2.11.1)
|
21
|
+
rspec-expectations (2.11.3)
|
22
|
+
diff-lcs (~> 1.1.3)
|
23
|
+
rspec-mocks (2.11.3)
|
24
|
+
simplecov (0.6.4)
|
25
|
+
multi_json (~> 1.0)
|
26
|
+
simplecov-html (~> 0.5.3)
|
27
|
+
simplecov-html (0.5.3)
|
13
28
|
|
14
29
|
PLATFORMS
|
15
30
|
ruby
|
16
31
|
|
17
32
|
DEPENDENCIES
|
18
|
-
bundler
|
19
|
-
jeweler
|
20
|
-
|
33
|
+
bundler
|
34
|
+
jeweler
|
35
|
+
rake
|
36
|
+
rspec
|
37
|
+
simplecov
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,24 @@
|
|
1
1
|
Ruby Version
|
2
2
|
============
|
3
3
|
|
4
|
-
**ruby-version** wraps the `RUBY_VERSION` constant and
|
5
|
-
number matching
|
4
|
+
**ruby-version** wraps the `RUBY_VERSION` and `RUBY_ENGINE` constant and
|
5
|
+
allows the elegant Ruby version number matching on all major Ruby platforms.
|
6
|
+
Usage is simple:
|
6
7
|
|
7
8
|
require "ruby-version"
|
8
9
|
|
9
10
|
Ruby::Version > "1.8.7"
|
10
11
|
# will return true for 1.9.2 and false for 1.8.3
|
12
|
+
|
13
|
+
Or for the ruby engine name:
|
14
|
+
|
15
|
+
Ruby::Engine::NAME
|
16
|
+
# will return "ruby" typically (works on 1.8 too of sure)
|
17
|
+
|
18
|
+
Ruby::Engine == "ruby" # or something else
|
19
|
+
# will return appropriate boolean
|
20
|
+
|
21
|
+
[](http://travis-ci.org/martinkozak/ruby-version)
|
11
22
|
|
12
23
|
Contributing
|
13
24
|
------------
|
@@ -22,7 +33,7 @@ Contributing
|
|
22
33
|
Copyright
|
23
34
|
---------
|
24
35
|
|
25
|
-
Copyright © 2011 [Martin Kozák][10]. See `LICENSE.txt` for
|
36
|
+
Copyright © 2011-2012 [Martin Kozák][10]. See `LICENSE.txt` for
|
26
37
|
further details.
|
27
38
|
|
28
39
|
[9]: http://github.com/martinkozak/ruby-version/issues
|
data/Rakefile
CHANGED
@@ -10,6 +10,8 @@ rescue Bundler::BundlerError => e
|
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
12
|
|
13
|
+
### Jeweler
|
14
|
+
|
13
15
|
require 'rake'
|
14
16
|
require 'jeweler'
|
15
17
|
|
@@ -18,7 +20,7 @@ Jeweler::Tasks.new do |gem|
|
|
18
20
|
gem.name = "ruby-version"
|
19
21
|
gem.homepage = "http://github.com/martinkozak/ruby-version"
|
20
22
|
gem.license = "MIT"
|
21
|
-
gem.summary = 'Wraps the RUBY_VERSION
|
23
|
+
gem.summary = 'Wraps the RUBY_VERSION and RUBY_ENGINE constants and allows the elegant Ruby version number matching on all major Ruby platforms.'
|
22
24
|
gem.email = "martinkozak@martinkozak.net"
|
23
25
|
gem.authors = ["Martin Kozák"]
|
24
26
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
@@ -26,4 +28,13 @@ Jeweler::Tasks.new do |gem|
|
|
26
28
|
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
27
29
|
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
28
30
|
end
|
29
|
-
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
Jeweler::RubygemsDotOrgTasks.new
|
32
|
+
|
33
|
+
### RSpec
|
34
|
+
|
35
|
+
require 'rspec/core/rake_task'
|
36
|
+
|
37
|
+
RSpec::Core::RakeTask.new(:test) do |t|
|
38
|
+
t.pattern = 'tests.rb'
|
39
|
+
t.rspec_opts = '--format d -c'
|
40
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.2
|
data/lib/ruby-version.rb
CHANGED
@@ -1,11 +1,41 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
2
|
+
# (c) 2011-2012 Martin Kozák (martinkozak@martinkozak.net)
|
3
3
|
|
4
4
|
##
|
5
5
|
# Outer wrapper for the {Ruby::Version} module.
|
6
6
|
#
|
7
7
|
|
8
8
|
module Ruby
|
9
|
+
|
10
|
+
##
|
11
|
+
# Wraps the +RUBY_ENGINE+ constant. In fact, handles returning the
|
12
|
+
# correct value on Ruby 1.8 in the main.
|
13
|
+
#
|
14
|
+
|
15
|
+
module Engine
|
16
|
+
|
17
|
+
##
|
18
|
+
# Contains the Ruby engine identification in frozen string.
|
19
|
+
#
|
20
|
+
|
21
|
+
begin
|
22
|
+
NAME = RUBY_ENGINE.dup.freeze
|
23
|
+
rescue NameError
|
24
|
+
NAME = "ruby".freeze
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Equality operator.
|
29
|
+
#
|
30
|
+
# @param [String, Symbol] value engine identifier
|
31
|
+
# @return [Boolean] +true+ if yes, +false otherwise
|
32
|
+
#
|
33
|
+
|
34
|
+
def self.==(value)
|
35
|
+
return self::NAME == value.to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
9
39
|
|
10
40
|
##
|
11
41
|
# Wraps the +RUBY_VERSION+ constant and provides some handling
|
data/ruby-version.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruby-version"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Koz\u{e1}k"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-10-06"
|
13
13
|
s.email = "martinkozak@martinkozak.net"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".document",
|
20
|
+
".travis.yml",
|
20
21
|
"Gemfile",
|
21
22
|
"Gemfile.lock",
|
22
23
|
"LICENSE.txt",
|
@@ -25,30 +26,36 @@ Gem::Specification.new do |s|
|
|
25
26
|
"VERSION",
|
26
27
|
"lib/ruby-version.rb",
|
27
28
|
"ruby-version.gemspec",
|
28
|
-
"
|
29
|
+
"tests.rb"
|
29
30
|
]
|
30
31
|
s.homepage = "http://github.com/martinkozak/ruby-version"
|
31
32
|
s.licenses = ["MIT"]
|
32
33
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = "1.8.
|
34
|
-
s.summary = "Wraps the RUBY_VERSION
|
34
|
+
s.rubygems_version = "1.8.24"
|
35
|
+
s.summary = "Wraps the RUBY_VERSION and RUBY_ENGINE constants and allows the elegant Ruby version number matching on all major Ruby platforms."
|
35
36
|
|
36
37
|
if s.respond_to? :specification_version then
|
37
38
|
s.specification_version = 3
|
38
39
|
|
39
40
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
|
-
s.add_development_dependency(%q<bundler>, [">=
|
41
|
-
s.add_development_dependency(%q<jeweler>, [">=
|
42
|
-
s.add_development_dependency(%q<
|
41
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
42
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
43
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
44
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
45
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
43
46
|
else
|
44
|
-
s.add_dependency(%q<bundler>, [">=
|
45
|
-
s.add_dependency(%q<jeweler>, [">=
|
46
|
-
s.add_dependency(%q<
|
47
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
48
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
49
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
50
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
51
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
47
52
|
end
|
48
53
|
else
|
49
|
-
s.add_dependency(%q<bundler>, [">=
|
50
|
-
s.add_dependency(%q<jeweler>, [">=
|
51
|
-
s.add_dependency(%q<
|
54
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
55
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
56
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
57
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
58
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
data/tests.rb
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
4
|
+
|
5
|
+
$:.push("./lib")
|
6
|
+
|
7
|
+
require "rubygems"
|
8
|
+
require "rspec"
|
9
|
+
|
10
|
+
require "simplecov"
|
11
|
+
SimpleCov.start
|
12
|
+
|
13
|
+
require "ruby-version"
|
14
|
+
|
15
|
+
###
|
16
|
+
|
17
|
+
LOWER = :"1.1.3"
|
18
|
+
CURRENT = RUBY_VERSION.to_sym
|
19
|
+
HIGHER = :"4.0.1"
|
20
|
+
|
21
|
+
###
|
22
|
+
|
23
|
+
describe Ruby::Engine do
|
24
|
+
specify "NAME shoud be something reasonable" do
|
25
|
+
not ['ruby', 'jruby', 'rbx'].include? Ruby::Engine::NAME
|
26
|
+
end
|
27
|
+
it "shoud be comparable" do
|
28
|
+
Ruby::Engine == "foo"
|
29
|
+
true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe Ruby::Version, "-- algebraic comparsion operators" do
|
34
|
+
|
35
|
+
context "against higher version" do
|
36
|
+
it "should be lower" do
|
37
|
+
Ruby::Version < HIGHER
|
38
|
+
end
|
39
|
+
it "should be lower or equal" do
|
40
|
+
Ruby::Version <= HIGHER
|
41
|
+
end
|
42
|
+
it "shouldn't be equal" do
|
43
|
+
not Ruby::Version == HIGHER
|
44
|
+
end
|
45
|
+
it "should be higher or equal" do
|
46
|
+
Ruby::Version >= HIGHER
|
47
|
+
end
|
48
|
+
it "should be higher" do
|
49
|
+
Ruby::Version > HIGHER
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "against current version" do
|
54
|
+
it "shouldn't be lower" do
|
55
|
+
not Ruby::Version < CURRENT
|
56
|
+
end
|
57
|
+
it "should be lower or equal" do
|
58
|
+
Ruby::Version <= CURRENT
|
59
|
+
end
|
60
|
+
it "should be equal" do
|
61
|
+
Ruby::Version == CURRENT
|
62
|
+
end
|
63
|
+
it "should be higher or equal" do
|
64
|
+
Ruby::Version >= CURRENT
|
65
|
+
end
|
66
|
+
it "shouldn't be higher" do
|
67
|
+
not Ruby::Version > HIGHER
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "against lower version" do
|
72
|
+
it "should be lower" do
|
73
|
+
Ruby::Version < LOWER
|
74
|
+
end
|
75
|
+
it "should be lower or equal" do
|
76
|
+
Ruby::Version <= LOWER
|
77
|
+
end
|
78
|
+
it "shouldn't be equal" do
|
79
|
+
not Ruby::Version == LOWER
|
80
|
+
end
|
81
|
+
it "shouldn't be higher or equal" do
|
82
|
+
not Ruby::Version >= LOWER
|
83
|
+
end
|
84
|
+
it "shouldn't be higher" do
|
85
|
+
not Ruby::Version > LOWER
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe Ruby::Version, "-- fuzzy operators" do
|
92
|
+
|
93
|
+
context "against higher version" do
|
94
|
+
specify "#<=> should return -1" do
|
95
|
+
(Ruby::Version <=> HIGHER) == -1
|
96
|
+
end
|
97
|
+
specify "#compare should return -1" do
|
98
|
+
Ruby::Version::compare(HIGHER) == -1
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "against current version" do
|
103
|
+
specify "#<=> should return 0" do
|
104
|
+
(Ruby::Version <=> CURRENT) == 0
|
105
|
+
end
|
106
|
+
specify "#compare should return 0" do
|
107
|
+
Ruby::Version::compare(CURRENT) == 0
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context "against lower version" do
|
112
|
+
specify "#<=> should return 1" do
|
113
|
+
(Ruby::Version <=> LOWER) == 1
|
114
|
+
end
|
115
|
+
specify "#compare should return 1" do
|
116
|
+
Ruby::Version::compare(LOWER) == -1
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe Ruby::Version do
|
122
|
+
|
123
|
+
specify "TOKENS constant content the same as broking result" do
|
124
|
+
Ruby::Version::TOKENS == Ruby::Version::broke(RUBY_VERSION)
|
125
|
+
end
|
126
|
+
specify "VERSION constant should be equal to RUBY_VERSION" do
|
127
|
+
Ruby::Version::VERSION == RUBY_VERSION
|
128
|
+
end
|
129
|
+
specify "broking components should equal to version string components" do
|
130
|
+
Ruby::Version::broke("1.2.3") == [1, 2, 3]
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,41 +9,88 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: jeweler
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
28
65
|
none: false
|
29
66
|
requirements:
|
30
67
|
- - ! '>='
|
31
68
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
69
|
+
version: '0'
|
33
70
|
type: :development
|
34
71
|
prerelease: false
|
35
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
36
78
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
79
|
+
name: simplecov
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
39
81
|
none: false
|
40
82
|
requirements:
|
41
83
|
- - ! '>='
|
42
84
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0
|
85
|
+
version: '0'
|
44
86
|
type: :development
|
45
87
|
prerelease: false
|
46
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
47
94
|
description:
|
48
95
|
email: martinkozak@martinkozak.net
|
49
96
|
executables: []
|
@@ -53,6 +100,7 @@ extra_rdoc_files:
|
|
53
100
|
- README.md
|
54
101
|
files:
|
55
102
|
- .document
|
103
|
+
- .travis.yml
|
56
104
|
- Gemfile
|
57
105
|
- Gemfile.lock
|
58
106
|
- LICENSE.txt
|
@@ -61,7 +109,7 @@ files:
|
|
61
109
|
- VERSION
|
62
110
|
- lib/ruby-version.rb
|
63
111
|
- ruby-version.gemspec
|
64
|
-
-
|
112
|
+
- tests.rb
|
65
113
|
homepage: http://github.com/martinkozak/ruby-version
|
66
114
|
licenses:
|
67
115
|
- MIT
|
@@ -77,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
125
|
version: '0'
|
78
126
|
segments:
|
79
127
|
- 0
|
80
|
-
hash:
|
128
|
+
hash: 1902862411478104695
|
81
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
130
|
none: false
|
83
131
|
requirements:
|
@@ -86,8 +134,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
134
|
version: '0'
|
87
135
|
requirements: []
|
88
136
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.8.
|
137
|
+
rubygems_version: 1.8.24
|
90
138
|
signing_key:
|
91
139
|
specification_version: 3
|
92
|
-
summary: Wraps the RUBY_VERSION
|
140
|
+
summary: Wraps the RUBY_VERSION and RUBY_ENGINE constants and allows the elegant Ruby
|
141
|
+
version number matching on all major Ruby platforms.
|
93
142
|
test_files: []
|
data/test
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
4
|
-
|
5
|
-
$:.push("./lib")
|
6
|
-
require "ruby-version"
|
7
|
-
require "riot"
|
8
|
-
|
9
|
-
DOWN = :"1.8.7"
|
10
|
-
CURRENT = :"1.9.2"
|
11
|
-
UP = :"2.0.1"
|
12
|
-
|
13
|
-
context "Ruby::Version" do
|
14
|
-
asserts("#<") do
|
15
|
-
Ruby::Version < UP and not Ruby::Version < DOWN and not Ruby::Version < CURRENT
|
16
|
-
end
|
17
|
-
asserts("#<=") do
|
18
|
-
Ruby::Version <= UP and not Ruby::Version <= DOWN and Ruby::Version <= CURRENT
|
19
|
-
end
|
20
|
-
asserts("#==") do
|
21
|
-
not Ruby::Version == UP and not Ruby::Version == DOWN and Ruby::Version == CURRENT
|
22
|
-
end
|
23
|
-
asserts("#>") do
|
24
|
-
not Ruby::Version > UP and Ruby::Version > DOWN and not Ruby::Version > CURRENT
|
25
|
-
end
|
26
|
-
asserts("#>=") do
|
27
|
-
not Ruby::Version >= UP and Ruby::Version >= DOWN and Ruby::Version >= CURRENT
|
28
|
-
end
|
29
|
-
asserts("#<=>") do
|
30
|
-
(Ruby::Version <=> UP) == -1 and (Ruby::Version <=> DOWN) == 1 and (Ruby::Version <=> CURRENT) == 0
|
31
|
-
end
|
32
|
-
asserts("#TOKENS") do
|
33
|
-
Ruby::Version::TOKENS == Ruby::Version::broke(RUBY_VERSION)
|
34
|
-
end
|
35
|
-
asserts("#VERSION") do
|
36
|
-
Ruby::Version::VERSION == RUBY_VERSION
|
37
|
-
end
|
38
|
-
asserts("#broke") do
|
39
|
-
Ruby::Version::broke("1.2.3") == [1, 2, 3]
|
40
|
-
end
|
41
|
-
asserts("#compare") do
|
42
|
-
Ruby::Version::compare(DOWN) == 1 and Ruby::Version::compare(CURRENT) == 0 and Ruby::Version::compare(UP) == -1
|
43
|
-
end
|
44
|
-
end
|