versionomy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +16 -0
- data/README.txt +134 -0
- data/Rakefile +49 -0
- data/lib/versionomy/errors.rb +107 -0
- data/lib/versionomy/format.rb +132 -0
- data/lib/versionomy/schema.rb +537 -0
- data/lib/versionomy/standard.rb +385 -0
- data/lib/versionomy/value.rb +291 -0
- data/lib/versionomy/version.rb +49 -0
- data/lib/versionomy.rb +46 -0
- data/tests/tc_standard_basic.rb +146 -0
- data/tests/tc_standard_bump.rb +170 -0
- data/tests/tc_standard_change.rb +97 -0
- data/tests/tc_standard_comparison.rb +77 -0
- data/tests/tc_standard_parse.rb +162 -0
- metadata +95 -0
@@ -0,0 +1,162 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Versionomy parsing tests on standard schema
|
4
|
+
#
|
5
|
+
# This file contains tests for parsing on the standard schema
|
6
|
+
#
|
7
|
+
# -----------------------------------------------------------------------------
|
8
|
+
# Copyright 2008 Daniel Azuma
|
9
|
+
#
|
10
|
+
# All rights reserved.
|
11
|
+
#
|
12
|
+
# Redistribution and use in source and binary forms, with or without
|
13
|
+
# modification, are permitted provided that the following conditions are met:
|
14
|
+
#
|
15
|
+
# * Redistributions of source code must retain the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer.
|
17
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
18
|
+
# this list of conditions and the following disclaimer in the documentation
|
19
|
+
# and/or other materials provided with the distribution.
|
20
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
21
|
+
# contributors to this software, may be used to endorse or promote products
|
22
|
+
# derived from this software without specific prior written permission.
|
23
|
+
#
|
24
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
25
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
26
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
27
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
28
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
29
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
35
|
+
# -----------------------------------------------------------------------------
|
36
|
+
|
37
|
+
|
38
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../lib/versionomy.rb")
|
39
|
+
|
40
|
+
|
41
|
+
module Versionomy
|
42
|
+
module Tests # :nodoc:
|
43
|
+
|
44
|
+
class TestStandardParse < Test::Unit::TestCase # :nodoc:
|
45
|
+
|
46
|
+
|
47
|
+
# Test parsing full.
|
48
|
+
|
49
|
+
def test_parsing_full_release
|
50
|
+
value_ = Versionomy.parse('2.0.1.1-4.6')
|
51
|
+
assert_equal(2, value_.major)
|
52
|
+
assert_equal(0, value_.minor)
|
53
|
+
assert_equal(1, value_.tiny)
|
54
|
+
assert_equal(1, value_.tiny2)
|
55
|
+
assert_equal(:release, value_.release_type)
|
56
|
+
assert_equal(4, value_.patchlevel)
|
57
|
+
assert_equal(6, value_.patchlevel_minor)
|
58
|
+
assert_equal('2.0.1.1-4.6', value_.unparse)
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
# Test parsing abbreviated.
|
63
|
+
|
64
|
+
def test_parsing_abbrev_release
|
65
|
+
value_ = Versionomy.parse('2.0.1')
|
66
|
+
assert_equal(2, value_.major)
|
67
|
+
assert_equal(0, value_.minor)
|
68
|
+
assert_equal(1, value_.tiny)
|
69
|
+
assert_equal(0, value_.tiny2)
|
70
|
+
assert_equal(:release, value_.release_type)
|
71
|
+
assert_equal(0, value_.patchlevel)
|
72
|
+
assert_equal(0, value_.patchlevel_minor)
|
73
|
+
assert_equal('2.0.1.0-0.0', value_.unparse(:required_fields => 4, :patchlevel_required_fields => 2))
|
74
|
+
assert_equal('2.0.1-0', value_.unparse(:required_fields => 1, :patchlevel_required_fields => 1))
|
75
|
+
assert_equal('2.0.1', value_.unparse)
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# Test parsing with trailing zeros.
|
80
|
+
|
81
|
+
def test_parsing_trailing_zeros
|
82
|
+
value_ = Versionomy.parse('2.0.0')
|
83
|
+
assert_equal(2, value_.major)
|
84
|
+
assert_equal(0, value_.minor)
|
85
|
+
assert_equal(0, value_.tiny)
|
86
|
+
assert_equal(0, value_.tiny2)
|
87
|
+
assert_equal(:release, value_.release_type)
|
88
|
+
assert_equal(0, value_.patchlevel)
|
89
|
+
assert_equal(0, value_.patchlevel_minor)
|
90
|
+
assert_equal('2.0.0', value_.unparse)
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
# Test parsing prerelease.
|
95
|
+
|
96
|
+
def test_parsing_prerelease
|
97
|
+
value_ = Versionomy.parse('2.0.1pre4')
|
98
|
+
assert_equal(2, value_.major)
|
99
|
+
assert_equal(0, value_.minor)
|
100
|
+
assert_equal(1, value_.tiny)
|
101
|
+
assert_equal(0, value_.tiny2)
|
102
|
+
assert_equal(:prerelease, value_.release_type)
|
103
|
+
assert_equal(4, value_.prerelease_version)
|
104
|
+
assert_equal(0, value_.prerelease_minor)
|
105
|
+
assert_equal('2.0.1pre4', value_.unparse)
|
106
|
+
assert_equal('2.0.1pre4.0', value_.unparse(:prerelease_required_fields => 2))
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
# Test parsing alpha.
|
111
|
+
|
112
|
+
def test_parsing_alpha
|
113
|
+
value_ = Versionomy.parse('2.0.1a4.1')
|
114
|
+
assert_equal(2, value_.major)
|
115
|
+
assert_equal(0, value_.minor)
|
116
|
+
assert_equal(1, value_.tiny)
|
117
|
+
assert_equal(0, value_.tiny2)
|
118
|
+
assert_equal(:alpha, value_.release_type)
|
119
|
+
assert_equal(4, value_.alpha_version)
|
120
|
+
assert_equal(1, value_.alpha_minor)
|
121
|
+
assert_equal('2.0.1a4.1', value_.unparse)
|
122
|
+
assert_equal('2.0.1a4.1', value_.unparse(:alpha_required_fields => 1))
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
# Test parsing beta.
|
127
|
+
|
128
|
+
def test_parsing_beta
|
129
|
+
value_ = Versionomy.parse('2.52.1b4.0')
|
130
|
+
assert_equal(2, value_.major)
|
131
|
+
assert_equal(52, value_.minor)
|
132
|
+
assert_equal(1, value_.tiny)
|
133
|
+
assert_equal(0, value_.tiny2)
|
134
|
+
assert_equal(:beta, value_.release_type)
|
135
|
+
assert_equal(4, value_.beta_version)
|
136
|
+
assert_equal(0, value_.beta_minor)
|
137
|
+
assert_equal('2.52.1b4.0', value_.unparse)
|
138
|
+
assert_equal('2.52.1b4', value_.unparse(:beta_required_fields => 1))
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
# Test parsing release candidate.
|
143
|
+
|
144
|
+
def test_parsing_release_candidate
|
145
|
+
value_ = Versionomy.parse('0.2rc0')
|
146
|
+
assert_equal(0, value_.major)
|
147
|
+
assert_equal(2, value_.minor)
|
148
|
+
assert_equal(0, value_.tiny)
|
149
|
+
assert_equal(0, value_.tiny2)
|
150
|
+
assert_equal(:release_candidate, value_.release_type)
|
151
|
+
assert_equal(0, value_.release_candidate_version)
|
152
|
+
assert_equal(0, value_.release_candidate_minor)
|
153
|
+
assert_equal('0.2rc0', value_.unparse)
|
154
|
+
assert_equal('0.2rc0.0', value_.unparse(:release_candidate_required_fields => 2))
|
155
|
+
assert_equal('0.2rc0', value_.unparse(:release_candidate_required_fields => 0))
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
162
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: versionomy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Azuma
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-20 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: blockenspiel
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.1
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.0
|
34
|
+
version:
|
35
|
+
description: Versionomy is a generalized version number library. It provides tools to represent, manipulate, parse, and compare version numbers in the wide variety of versioning schemes in use.
|
36
|
+
email:
|
37
|
+
- dazuma@gmail.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
46
|
+
files:
|
47
|
+
- History.txt
|
48
|
+
- Manifest.txt
|
49
|
+
- README.txt
|
50
|
+
- Rakefile
|
51
|
+
- lib/versionomy.rb
|
52
|
+
- lib/versionomy/errors.rb
|
53
|
+
- lib/versionomy/schema.rb
|
54
|
+
- lib/versionomy/format.rb
|
55
|
+
- lib/versionomy/value.rb
|
56
|
+
- lib/versionomy/standard.rb
|
57
|
+
- lib/versionomy/version.rb
|
58
|
+
- tests/tc_standard_basic.rb
|
59
|
+
- tests/tc_standard_bump.rb
|
60
|
+
- tests/tc_standard_change.rb
|
61
|
+
- tests/tc_standard_comparison.rb
|
62
|
+
- tests/tc_standard_parse.rb
|
63
|
+
has_rdoc: true
|
64
|
+
homepage: http://virtuoso.rubyforge.org/versionomy
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options:
|
67
|
+
- --main
|
68
|
+
- README.txt
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: "0"
|
82
|
+
version:
|
83
|
+
requirements: []
|
84
|
+
|
85
|
+
rubyforge_project: virtuoso
|
86
|
+
rubygems_version: 1.3.0
|
87
|
+
signing_key:
|
88
|
+
specification_version: 2
|
89
|
+
summary: Versionomy is a generalized version number library
|
90
|
+
test_files:
|
91
|
+
- tests/tc_standard_basic.rb
|
92
|
+
- tests/tc_standard_bump.rb
|
93
|
+
- tests/tc_standard_change.rb
|
94
|
+
- tests/tc_standard_comparison.rb
|
95
|
+
- tests/tc_standard_parse.rb
|