versionomy 0.4.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.
@@ -1,17 +1,17 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Versionomy tests on rubygems schema conversions
4
- #
4
+ #
5
5
  # This file contains tests converting to and from the rubygems schema
6
- #
6
+ #
7
7
  # -----------------------------------------------------------------------------
8
8
  # Copyright 2008-2009 Daniel Azuma
9
- #
9
+ #
10
10
  # All rights reserved.
11
- #
11
+ #
12
12
  # Redistribution and use in source and binary forms, with or without
13
13
  # modification, are permitted provided that the following conditions are met:
14
- #
14
+ #
15
15
  # * Redistributions of source code must retain the above copyright notice,
16
16
  # this list of conditions and the following disclaimer.
17
17
  # * Redistributions in binary form must reproduce the above copyright notice,
@@ -20,7 +20,7 @@
20
20
  # * Neither the name of the copyright holder, nor the names of any other
21
21
  # contributors to this software, may be used to endorse or promote products
22
22
  # derived from this software without specific prior written permission.
23
- #
23
+ #
24
24
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
25
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
26
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -41,18 +41,18 @@ require 'versionomy'
41
41
 
42
42
  module Versionomy
43
43
  module Tests # :nodoc:
44
-
44
+
45
45
  class TestSemverConversions < ::Test::Unit::TestCase # :nodoc:
46
-
47
-
46
+
47
+
48
48
  def setup
49
49
  @standard_format = Format.get(:standard)
50
50
  @semver_format = Format.get(:semver)
51
51
  end
52
-
53
-
52
+
53
+
54
54
  # Test simple conversion from standard to semver.
55
-
55
+
56
56
  def test_standard_to_semver_simple
57
57
  value_ = ::Versionomy.parse('1.2')
58
58
  value2_ = value_.convert(:semver)
@@ -63,10 +63,10 @@ module Versionomy
63
63
  assert_equal(@semver_format, value2_.format)
64
64
  assert_equal([1, 2, 4, ''], value2_.values_array)
65
65
  end
66
-
67
-
66
+
67
+
68
68
  # Test conversion from standard to semver with a beta version
69
-
69
+
70
70
  def test_standard_to_semver_beta
71
71
  value_ = ::Versionomy.parse('1.2b3')
72
72
  value2_ = value_.convert(:semver)
@@ -75,10 +75,10 @@ module Versionomy
75
75
  value2_ = value_.convert(:semver)
76
76
  assert_equal([1, 2, 0, 'beta3'], value2_.values_array)
77
77
  end
78
-
79
-
78
+
79
+
80
80
  # Test conversion from standard to semver with a "v" prefix
81
-
81
+
82
82
  def test_standard_to_semver_with_v
83
83
  value_ = ::Versionomy.parse('v1.2.3')
84
84
  value2_ = value_.convert(:semver)
@@ -87,20 +87,20 @@ module Versionomy
87
87
  value2_ = value_.convert(:semver)
88
88
  assert_equal([1, 2, 3, ''], value2_.values_array)
89
89
  end
90
-
91
-
90
+
91
+
92
92
  # Test conversion from standard to semver with an expectation of failure
93
-
93
+
94
94
  def test_standard_to_semver_fail
95
95
  value_ = ::Versionomy.parse('1.2.3.4', :standard)
96
96
  assert_raise(::Versionomy::Errors::ConversionError) do
97
97
  value2_ = value_.convert(:semver)
98
98
  end
99
99
  end
100
-
101
-
100
+
101
+
102
102
  # Test simple conversion from semver to standard.
103
-
103
+
104
104
  def test_semver_to_standard_simple
105
105
  value_ = ::Versionomy.parse('1.2', :semver)
106
106
  value2_ = value_.convert(:standard)
@@ -111,10 +111,10 @@ module Versionomy
111
111
  assert_equal(@standard_format, value2_.format)
112
112
  assert_equal([1, 2, 4, 0, :final, 0, 0], value2_.values_array)
113
113
  end
114
-
115
-
114
+
115
+
116
116
  # Test conversion from semver to standard with a beta version
117
-
117
+
118
118
  def test_semver_to_standard_beta
119
119
  value_ = ::Versionomy.parse('1.2.0b3', :semver)
120
120
  value2_ = value_.convert(:standard)
@@ -123,29 +123,29 @@ module Versionomy
123
123
  value2_ = value_.convert(:standard)
124
124
  assert_equal([1, 2, 4, 0, :beta, 3, 0], value2_.values_array)
125
125
  end
126
-
127
-
126
+
127
+
128
128
  # Test conversion from rubygems to standard with an expectation of failure
129
-
129
+
130
130
  def test_semver_to_standard_fail
131
131
  value_ = ::Versionomy.parse('1.2.3c4', :semver)
132
132
  assert_raise(::Versionomy::Errors::ConversionError) do
133
133
  value2_ = value_.convert(:standard)
134
134
  end
135
135
  end
136
-
137
-
136
+
137
+
138
138
  # Test conversion when there aren't unparse_params
139
-
139
+
140
140
  def test_standard_to_semver_without_unparse_params
141
141
  value_ = ::Versionomy.create([1,2,3], :standard)
142
142
  value2_ = value_.convert(:semver)
143
143
  assert_equal([1, 2, 3, ''], value2_.values_array)
144
144
  end
145
-
146
-
145
+
146
+
147
147
  # Test conversion between semver and rubygems
148
-
148
+
149
149
  def test_semver_and_rubygems
150
150
  value_ = ::Versionomy.create([1,2,3], :semver)
151
151
  value2_ = value_.convert(:rubygems)
@@ -154,43 +154,43 @@ module Versionomy
154
154
  value2_ = value_.convert(:semver)
155
155
  assert_equal([1, 2, 3, ''], value2_.values_array)
156
156
  end
157
-
158
-
157
+
158
+
159
159
  # Test equality comparisons between semver and standard
160
-
160
+
161
161
  def test_semver_to_standard_equality_comparison
162
162
  assert_operator(::Versionomy.parse('1.2.0', :semver), :==, ::Versionomy.parse('1.2'))
163
163
  assert_operator(::Versionomy.parse('1.2.0b3', :semver), :==, ::Versionomy.parse('1.2b3'))
164
164
  end
165
-
166
-
165
+
166
+
167
167
  # Test inequality comparisons between semver and standard
168
-
168
+
169
169
  def test_semver_to_standard_inequality_comparison
170
170
  assert_operator(::Versionomy.parse('1.2.3', :semver), :<, ::Versionomy.parse('1.2.4'))
171
171
  assert_operator(::Versionomy.parse('1.2.0b3', :semver), :>, ::Versionomy.parse('1.2b2'))
172
172
  assert_operator(::Versionomy.parse('1.2.0', :semver), :>, ::Versionomy.parse('1.2b1'))
173
173
  end
174
-
175
-
174
+
175
+
176
176
  # Test equality comparisons between standard and rubygems
177
-
177
+
178
178
  def test_standard_to_semver_equality_comparison
179
179
  assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2.0', :semver))
180
180
  assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.0beta3', :semver))
181
181
  end
182
-
183
-
182
+
183
+
184
184
  # Test inequality comparisons between standard and rubygems
185
-
185
+
186
186
  def test_standard_to_semver_inequality_comparison
187
187
  assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :semver))
188
188
  assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0beta3', :semver))
189
189
  assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0', :semver))
190
190
  end
191
-
192
-
191
+
192
+
193
193
  end
194
-
194
+
195
195
  end
196
196
  end
@@ -1,17 +1,17 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Versionomy basic tests on standard schema
4
- #
4
+ #
5
5
  # This file contains tests for the basic use cases on the standard schema
6
- #
6
+ #
7
7
  # -----------------------------------------------------------------------------
8
8
  # Copyright 2008-2009 Daniel Azuma
9
- #
9
+ #
10
10
  # All rights reserved.
11
- #
11
+ #
12
12
  # Redistribution and use in source and binary forms, with or without
13
13
  # modification, are permitted provided that the following conditions are met:
14
- #
14
+ #
15
15
  # * Redistributions of source code must retain the above copyright notice,
16
16
  # this list of conditions and the following disclaimer.
17
17
  # * Redistributions in binary form must reproduce the above copyright notice,
@@ -20,7 +20,7 @@
20
20
  # * Neither the name of the copyright holder, nor the names of any other
21
21
  # contributors to this software, may be used to endorse or promote products
22
22
  # derived from this software without specific prior written permission.
23
- #
23
+ #
24
24
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
25
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
26
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -41,12 +41,12 @@ require 'versionomy'
41
41
 
42
42
  module Versionomy
43
43
  module Tests # :nodoc:
44
-
44
+
45
45
  class TestStandardBasic < ::Test::Unit::TestCase # :nodoc:
46
-
47
-
46
+
47
+
48
48
  # Test the default version value.
49
-
49
+
50
50
  def test_default_value
51
51
  value_ = ::Versionomy.create
52
52
  assert_equal(1, value_.major)
@@ -57,10 +57,10 @@ module Versionomy
57
57
  assert_equal(0, value_.patchlevel)
58
58
  assert_equal(0, value_.patchlevel_minor)
59
59
  end
60
-
61
-
60
+
61
+
62
62
  # Test an arbitrary release value.
63
-
63
+
64
64
  def test_release_value_1
65
65
  value_ = ::Versionomy.create(:major => 1, :tiny => 4, :tiny2 => 2, :patchlevel => 5)
66
66
  assert_equal(1, value_.major)
@@ -73,10 +73,10 @@ module Versionomy
73
73
  assert_equal(false, value_.has_field?(:prerelase_version))
74
74
  assert_equal(false, value_.has_field?(:prerelase_minor))
75
75
  end
76
-
77
-
76
+
77
+
78
78
  # Test an arbitrary release value.
79
-
79
+
80
80
  def test_release_value_2
81
81
  value_ = ::Versionomy.create(:major => 0, :minor => 3)
82
82
  assert_equal(0, value_.major)
@@ -89,10 +89,10 @@ module Versionomy
89
89
  assert_equal(false, value_.has_field?(:prerelase_version))
90
90
  assert_equal(false, value_.has_field?(:prerelase_minor))
91
91
  end
92
-
93
-
92
+
93
+
94
94
  # Test an arbitrary preview value.
95
-
95
+
96
96
  def test_preview_value_1
97
97
  value_ = ::Versionomy.create(:major => 2, :minor => 3, :release_type => :preview, :preview_version => 3)
98
98
  assert_equal(2, value_.major)
@@ -105,10 +105,10 @@ module Versionomy
105
105
  assert_equal(false, value_.has_field?(:patchlevel))
106
106
  assert_equal(false, value_.has_field?(:patchlevel_minor))
107
107
  end
108
-
109
-
108
+
109
+
110
110
  # Test an arbitrary preview value.
111
-
111
+
112
112
  def test_preview_value_2
113
113
  value_ = ::Versionomy.create(:major => 2, :minor => 3, :release_type => :preview)
114
114
  assert_equal(2, value_.major)
@@ -121,10 +121,10 @@ module Versionomy
121
121
  assert_equal(false, value_.has_field?(:patchlevel))
122
122
  assert_equal(false, value_.has_field?(:patchlevel_minor))
123
123
  end
124
-
125
-
124
+
125
+
126
126
  # Test an arbitrary beta value.
127
-
127
+
128
128
  def test_beta_value
129
129
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :beta, :beta_version => 3)
130
130
  assert_equal(2, value_.major)
@@ -139,10 +139,10 @@ module Versionomy
139
139
  assert_equal(false, value_.has_field?(:patchlevel))
140
140
  assert_equal(false, value_.has_field?(:patchlevel_minor))
141
141
  end
142
-
143
-
142
+
143
+
144
144
  # Test specifying fields by index.
145
-
145
+
146
146
  def test_field_get_index
147
147
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :beta, :beta_version => 3)
148
148
  assert_equal(2, value_[0])
@@ -153,10 +153,10 @@ module Versionomy
153
153
  assert_equal(3, value_[5])
154
154
  assert_equal(0, value_[6])
155
155
  end
156
-
157
-
156
+
157
+
158
158
  # Test specifying fields by name.
159
-
159
+
160
160
  def test_field_get_name
161
161
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :beta, :beta_version => 3)
162
162
  assert_equal(2, value_[:major])
@@ -167,9 +167,9 @@ module Versionomy
167
167
  assert_equal(3, value_[:beta_version])
168
168
  assert_equal(0, value_[:beta_minor])
169
169
  end
170
-
171
-
170
+
171
+
172
172
  end
173
-
173
+
174
174
  end
175
175
  end
@@ -1,17 +1,17 @@
1
1
  # -----------------------------------------------------------------------------
2
- #
2
+ #
3
3
  # Versionomy bump tests on standard schema
4
- #
4
+ #
5
5
  # This file contains tests for the bump function on the standard schema
6
- #
6
+ #
7
7
  # -----------------------------------------------------------------------------
8
8
  # Copyright 2008-2009 Daniel Azuma
9
- #
9
+ #
10
10
  # All rights reserved.
11
- #
11
+ #
12
12
  # Redistribution and use in source and binary forms, with or without
13
13
  # modification, are permitted provided that the following conditions are met:
14
- #
14
+ #
15
15
  # * Redistributions of source code must retain the above copyright notice,
16
16
  # this list of conditions and the following disclaimer.
17
17
  # * Redistributions in binary form must reproduce the above copyright notice,
@@ -20,7 +20,7 @@
20
20
  # * Neither the name of the copyright holder, nor the names of any other
21
21
  # contributors to this software, may be used to endorse or promote products
22
22
  # derived from this software without specific prior written permission.
23
- #
23
+ #
24
24
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
25
  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
26
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -41,12 +41,12 @@ require 'versionomy'
41
41
 
42
42
  module Versionomy
43
43
  module Tests # :nodoc:
44
-
44
+
45
45
  class TestStandardBump < ::Test::Unit::TestCase # :nodoc:
46
-
47
-
46
+
47
+
48
48
  # Test bumping a minor patchlevel.
49
-
49
+
50
50
  def test_bump_patchlevel_minor
51
51
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :patchlevel => 3, :patchlevel_minor => 0)
52
52
  value_ = value_.bump(:patchlevel_minor)
@@ -58,10 +58,10 @@ module Versionomy
58
58
  assert_equal(3, value_.patchlevel)
59
59
  assert_equal(1, value_.patchlevel_minor)
60
60
  end
61
-
62
-
61
+
62
+
63
63
  # Test bumping a major patchlevel.
64
-
64
+
65
65
  def test_bump_patchlevel
66
66
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :patchlevel => 3, :patchlevel_minor => 1)
67
67
  value_ = value_.bump(:patchlevel)
@@ -73,10 +73,10 @@ module Versionomy
73
73
  assert_equal(4, value_.patchlevel)
74
74
  assert_equal(0, value_.patchlevel_minor)
75
75
  end
76
-
77
-
76
+
77
+
78
78
  # Test bumping release type preview.
79
-
79
+
80
80
  def test_bump_preview_to_release
81
81
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :preview)
82
82
  value_ = value_.bump(:release_type)
@@ -88,10 +88,10 @@ module Versionomy
88
88
  assert_equal(0, value_.patchlevel)
89
89
  assert_equal(0, value_.patchlevel_minor)
90
90
  end
91
-
92
-
91
+
92
+
93
93
  # Test bumping release type development.
94
-
94
+
95
95
  def test_bump_development_to_alpha
96
96
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :development, :development_version => 7)
97
97
  value_ = value_.bump(:release_type)
@@ -103,10 +103,10 @@ module Versionomy
103
103
  assert_equal(1, value_.alpha_version)
104
104
  assert_equal(0, value_.alpha_minor)
105
105
  end
106
-
107
-
106
+
107
+
108
108
  # Test bumping release type alpha.
109
-
109
+
110
110
  def test_bump_alpha_to_beta
111
111
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :alpha)
112
112
  value_ = value_.bump(:release_type)
@@ -118,10 +118,10 @@ module Versionomy
118
118
  assert_equal(1, value_.beta_version)
119
119
  assert_equal(0, value_.beta_minor)
120
120
  end
121
-
122
-
121
+
122
+
123
123
  # Test bumping release type release_candidate.
124
-
124
+
125
125
  def test_bump_release_candidate_to_release
126
126
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :release_candidate, :release_candidate_version => 2)
127
127
  value_ = value_.bump(:release_type)
@@ -133,10 +133,10 @@ module Versionomy
133
133
  assert_equal(0, value_.patchlevel)
134
134
  assert_equal(0, value_.patchlevel_minor)
135
135
  end
136
-
137
-
136
+
137
+
138
138
  # Test bumping tiny.
139
-
139
+
140
140
  def test_bump_tiny
141
141
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :tiny2 => 3, :release_type => :release_candidate, :release_candidate_version => 2)
142
142
  value_ = value_.bump(:tiny)
@@ -148,10 +148,10 @@ module Versionomy
148
148
  assert_equal(0, value_.patchlevel)
149
149
  assert_equal(0, value_.patchlevel_minor)
150
150
  end
151
-
152
-
151
+
152
+
153
153
  # Test bumping major.
154
-
154
+
155
155
  def test_bump_major
156
156
  value_ = ::Versionomy.create(:major => 2, :tiny => 1, :tiny2 => 3, :release_type => :release_candidate, :release_candidate_version => 2)
157
157
  value_ = value_.bump(:major)
@@ -163,9 +163,9 @@ module Versionomy
163
163
  assert_equal(0, value_.patchlevel)
164
164
  assert_equal(0, value_.patchlevel_minor)
165
165
  end
166
-
167
-
166
+
167
+
168
168
  end
169
-
169
+
170
170
  end
171
171
  end