Skip to content
This repository

Failing test cases for requirements range expressions and prereleases #350

Open
wants to merge 6 commits into from

3 participants

David Kellum Don't Add Me To Your Organization a.k.a The Travis Bot Eric Hodel
David Kellum

Here is an oddity, continued from #349:

Prereleases are included in >=, < requirement ranges, even when they don't have prerelease segments. But anyone specifying for example < 1.5.0 is most certainly not expecting to use 1.5.0.beta.0 if they happen to have it installed.

Failed test output:

 1) Failure:
test_satisfied_by_range_postfix(TestGemRequirement) [./test/rubygems/test_gem_requirement.rb:387]:
[">= 1.4", "< 1.5"] should not be satisfied by 1.5.0.beta.0

  2) Failure:
test_satisfied_by_range_pre_inplace(TestGemRequirement) [./test/rubygems/test_gem_requirement.rb:351]:
[">= 1.4.beta", "< 1.5"] should not be satisfied by 1.5.alpha.0

  3) Failure:
test_satisfied_by_range_3_postfix(TestGemRequirement) [./test/rubygems/test_gem_requirement.rb:402]:
[">= 1.4.0", "< 1.5.0"] should not be satisfied by 1.5.0.beta.0

  4) Failure:
test_satisfied_by_range_with_pre_postfix(TestGemRequirement) [./test/rubygems/test_gem_requirement.rb:420]:
[">= 1.4.0.beta", "< 1.5"] should not be satisfied by 1.5.0.alpha.0

  5) Failure:
test_satisfied_by_range_inplace(TestGemRequirement) [./test/rubygems/test_gem_requirement.rb:371]:
[">= 1.4", "< 1.5"] should not be satisfied by 1.5.alpha.0

Also, a command line example:

% gem list bundler
*** LOCAL GEMS ***
bundler (1.2.0.pre.1, 1.1.3, 1.1.0, 1.1.rc.8)

% ruby -rubygems -e "gem( 'bundler', [ '>= 1.1', '< 1.2' ] ); require 'bundler'; puts Bundler::VERSION"
1.2.0.pre.1

Is this all expected behavior?

Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request fails (merged 069b6e6 into 1e97cce).

Eric Hodel
Owner

Prereleases were always intended to be a "buyer beware" or "I know what I'm doing" feature. Users of prereleases are expected to pay attention to potential bugs in the releases they install. Due to the potential for bugs they'll need to be sure they're using the latest prerelease and upgrade to the latest version after the official release.

I don't think it's worth our time to attempt to implement a fix for these failing test cases.

We will review a patch that addresses the failures you have created here.

I'm moving this issue from the 2.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 201 additions and 2 deletions. Show diff stats Hide diff stats

  1. 203  test/rubygems/test_gem_requirement.rb
203  test/rubygems/test_gem_requirement.rb
@@ -225,6 +225,205 @@ def test_satisfied_by_eh_boxed
225 225
     refute_satisfied_by "2.0.a",   "~> 2.0"
226 226
   end
227 227
 
  228
+  def test_satisfied_by_spermy_inplace_pre
  229
+    req = "~> 1.4.beta"
  230
+
  231
+    refute_satisfied_by "1.3.beta.0",  req
  232
+    refute_satisfied_by "1.3",         req
  233
+    refute_satisfied_by "1.3.0",       req
  234
+
  235
+    refute_satisfied_by "1.4.alpha",   req
  236
+    refute_satisfied_by "1.4.alpha.0", req
  237
+
  238
+    assert_satisfied_by "1.4.beta",    req
  239
+    assert_satisfied_by "1.4.beta.0",  req
  240
+    assert_satisfied_by "1.4",         req
  241
+    assert_satisfied_by "1.4.0",       req
  242
+    assert_satisfied_by "1.4.1",       req
  243
+
  244
+    # See more delicate versions compared below
  245
+
  246
+    refute_satisfied_by "2.0",         req
  247
+    refute_satisfied_by "2.0.0",       req
  248
+  end
  249
+
  250
+  def test_satisfied_by_spermy_inplace_pre_next_minor
  251
+    skip "Spermy won't match as expected with inplace prerelease versions"
  252
+    req = "~> 1.4.beta"
  253
+    refute_satisfied_by "1.5.alpha",   req
  254
+    refute_satisfied_by "1.5.beta.0",  req
  255
+    refute_satisfied_by "1.5",         req
  256
+    refute_satisfied_by "1.5.0",       req
  257
+    refute_satisfied_by "1.5.1",       req
  258
+  end
  259
+
  260
+  def test_satisfied_by_spermy_postfix_pre
  261
+    req = "~> 1.4.0.beta"
  262
+
  263
+    refute_satisfied_by "1.3.0.beta.0",  req
  264
+    refute_satisfied_by "1.3",           req
  265
+    refute_satisfied_by "1.3.0",         req
  266
+
  267
+    refute_satisfied_by "1.4.alpha",     req
  268
+    refute_satisfied_by "1.4.alpha.0",   req
  269
+    refute_satisfied_by "1.4.0.alpha",   req
  270
+    refute_satisfied_by "1.4.0.alpha.0", req
  271
+
  272
+    assert_satisfied_by "1.4.0.beta",    req
  273
+    assert_satisfied_by "1.4.0.beta.0",  req
  274
+    assert_satisfied_by "1.4",           req
  275
+    assert_satisfied_by "1.4.0",         req
  276
+    assert_satisfied_by "1.4.1",         req
  277
+
  278
+    refute_satisfied_by "2.0",           req
  279
+    refute_satisfied_by "2.0.0",         req
  280
+
  281
+    refute_satisfied_by "1.5",           req
  282
+    refute_satisfied_by "1.5.0.alpha",   req
  283
+    refute_satisfied_by "1.5.0.beta.0",  req
  284
+    refute_satisfied_by "1.5.0",         req
  285
+    refute_satisfied_by "1.5.1",         req
  286
+  end
  287
+
  288
+  def test_satisfied_by_spermy_postfix_pre_sub
  289
+    req = "~> 1.4.0.beta.1"
  290
+
  291
+    refute_satisfied_by "1.3.0.beta.0",  req
  292
+    refute_satisfied_by "1.3",           req
  293
+    refute_satisfied_by "1.3.0",         req
  294
+
  295
+    refute_satisfied_by "1.4.alpha",     req
  296
+    refute_satisfied_by "1.4.alpha.0",   req
  297
+    refute_satisfied_by "1.4.0.alpha",   req
  298
+    refute_satisfied_by "1.4.0.alpha.0", req
  299
+
  300
+    refute_satisfied_by "1.4.0.beta",    req
  301
+    refute_satisfied_by "1.4.0.beta.0",  req
  302
+
  303
+    assert_satisfied_by "1.4.0.beta.1",  req
  304
+    assert_satisfied_by "1.4",           req
  305
+    assert_satisfied_by "1.4.0",         req
  306
+    assert_satisfied_by "1.4.1",         req
  307
+
  308
+    refute_satisfied_by "2.0",           req
  309
+    refute_satisfied_by "2.0.0",         req
  310
+
  311
+    refute_satisfied_by "1.5",           req
  312
+    refute_satisfied_by "1.5.0.alpha",   req
  313
+    refute_satisfied_by "1.5.0.beta.0",  req
  314
+    refute_satisfied_by "1.5.0",         req
  315
+    refute_satisfied_by "1.5.1",         req
  316
+  end
  317
+
  318
+  def test_satisfied_by_spermy_release
  319
+    req = "~> 1.4.0"
  320
+
  321
+    refute_satisfied_by "1.3.beta.0",  req
  322
+    refute_satisfied_by "1.3",         req
  323
+    refute_satisfied_by "1.3.0",       req
  324
+    refute_satisfied_by "1.3.alpha.0", req
  325
+
  326
+    refute_satisfied_by "1.4.beta.0",  req
  327
+    assert_satisfied_by "1.4",         req
  328
+    assert_satisfied_by "1.4.0",       req
  329
+    assert_satisfied_by "1.4.1",       req
  330
+
  331
+    refute_satisfied_by "1.5.alpha.0", req
  332
+    refute_satisfied_by "1.5.beta.0",  req
  333
+    refute_satisfied_by "1.5",         req
  334
+    refute_satisfied_by "1.5.0",       req
  335
+    refute_satisfied_by "1.5.1",       req
  336
+  end
  337
+
  338
+  def test_satisfied_by_range_pre_inplace
  339
+    req = [ ">= 1.4.beta", "< 1.5" ]
  340
+
  341
+    refute_satisfied_by "1.3.alpha.0", req
  342
+    refute_satisfied_by "1.4.alpha.0", req
  343
+
  344
+    assert_satisfied_by "1.4.beta.0",  req
  345
+    assert_satisfied_by "1.4.beta.1",  req
  346
+
  347
+    assert_satisfied_by "1.4",         req
  348
+    assert_satisfied_by "1.4.0",       req
  349
+    assert_satisfied_by "1.4.1",       req
  350
+
  351
+    refute_satisfied_by "1.5.alpha.0", req
  352
+    refute_satisfied_by "1.5.beta.0",  req
  353
+    refute_satisfied_by "1.5",         req
  354
+    refute_satisfied_by "1.5.0",       req
  355
+    refute_satisfied_by "1.5.1",       req
  356
+  end
  357
+
  358
+  def test_satisfied_by_range_inplace
  359
+    req = [ ">= 1.4", "< 1.5" ]
  360
+
  361
+    refute_satisfied_by "1.3.alpha.0", req
  362
+    refute_satisfied_by "1.4.alpha.0", req
  363
+
  364
+    refute_satisfied_by "1.4.beta.0",  req
  365
+    refute_satisfied_by "1.4.beta.1",  req
  366
+
  367
+    assert_satisfied_by "1.4",         req
  368
+    assert_satisfied_by "1.4.0",       req
  369
+    assert_satisfied_by "1.4.1",       req
  370
+
  371
+    refute_satisfied_by "1.5.alpha.0", req
  372
+    refute_satisfied_by "1.5.beta.0",  req
  373
+    refute_satisfied_by "1.5",         req
  374
+    refute_satisfied_by "1.5.0",       req
  375
+    refute_satisfied_by "1.5.1",       req
  376
+  end
  377
+
  378
+  def test_satisfied_by_range_postfix
  379
+    req = [ ">= 1.4", "< 1.5" ]
  380
+
  381
+    refute_satisfied_by "1.4.0.beta.0",  req
  382
+
  383
+    assert_satisfied_by "1.4",           req
  384
+    assert_satisfied_by "1.4.0",         req
  385
+    assert_satisfied_by "1.4.1",         req
  386
+
  387
+    refute_satisfied_by "1.5.0.beta.0",  req
  388
+    refute_satisfied_by "1.5",           req
  389
+    refute_satisfied_by "1.5.0",         req
  390
+    refute_satisfied_by "1.5.1",         req
  391
+  end
  392
+
  393
+  def test_satisfied_by_range_3_postfix
  394
+    req = [ ">= 1.4.0", "< 1.5.0" ]
  395
+
  396
+    refute_satisfied_by "1.4.0.beta.0",  req
  397
+
  398
+    assert_satisfied_by "1.4",           req
  399
+    assert_satisfied_by "1.4.0",         req
  400
+    assert_satisfied_by "1.4.1",         req
  401
+
  402
+    refute_satisfied_by "1.5.0.beta.0",  req
  403
+    refute_satisfied_by "1.5",           req
  404
+    refute_satisfied_by "1.5.0",         req
  405
+    refute_satisfied_by "1.5.1",         req
  406
+  end
  407
+
  408
+  def test_satisfied_by_range_with_pre_postfix
  409
+    req = [ ">= 1.4.0.beta", "< 1.5" ]
  410
+
  411
+    refute_satisfied_by "1.3.0.alpha.0", req
  412
+    refute_satisfied_by "1.4.0.alpha.0", req
  413
+
  414
+    assert_satisfied_by "1.4.0.beta.0",  req
  415
+    assert_satisfied_by "1.4.0.beta.1",  req
  416
+
  417
+    assert_satisfied_by "1.4.0",         req
  418
+    assert_satisfied_by "1.4.1",         req
  419
+
  420
+    refute_satisfied_by "1.5.0.alpha.0", req
  421
+    refute_satisfied_by "1.5.0.beta.0",  req
  422
+    refute_satisfied_by "1.5",           req
  423
+    refute_satisfied_by "1.5.0",         req
  424
+    refute_satisfied_by "1.5.1",         req
  425
+  end
  426
+
228 427
   def test_satisfied_by_eh_multiple
229 428
     req = [">= 1.4", "<= 1.6", "!= 1.5"]
230 429
 
@@ -291,7 +490,7 @@ def assert_requirement_equal expected, actual
291 490
 
292 491
   def assert_satisfied_by version, requirement
293 492
     assert req(requirement).satisfied_by?(v(version)),
294  
-      "#{requirement} is satisfied by #{version}"
  493
+      "#{requirement} should be satisfied by #{version}"
295 494
   end
296 495
 
297 496
   # Refute the assumption that two requirements are equal.
@@ -304,6 +503,6 @@ def refute_requirement_equal unexpected, actual
304 503
 
305 504
   def refute_satisfied_by version, requirement
306 505
     refute req(requirement).satisfied_by?(v(version)),
307  
-      "#{requirement} is not satisfied by #{version}"
  506
+      "#{requirement} should not be satisfied by #{version}"
308 507
   end
309 508
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.