Skip to content
This repository

pushing failing test for browser version comparison #22

Merged
merged 1 commit into from about 2 years ago

2 participants

Kevin Bedell Joshua Peek
Kevin Bedell

Josh,

I'm pushing this test as you asked.

I've got probably 40-50 other tests I've built out to evaluate different user agent strings. I'll try to put them into a form where I can send them over as well.

Joshua Peek josh merged commit f24ca77 into from
Joshua Peek josh closed this
Joshua Peek josh referenced this pull request from a commit
Joshua Peek Revert "Merge pull request #22 from kevinzen/master"
This reverts commit f24ca77, reversing
changes made to 8386155.
ffbc4d1
Joshua Peek
Owner
josh commented

Err crap, we're not going to be able to fix this because of an ambiguous case.

Simple case 4.b6 vs 4.0, 4 and 4 both equal, but we actually want to prefer 0 over b6 since betas typically come before the final one. So we always pick digits over letters.

Kevin Bedell

Not sure I agree. You're assuming that 'b' means beta -- but it may not always. I'd recommend straight alpha numeric comparisons.

I have some other thoughts I'm working on - I'll send them later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 12, 2012
Kevin Bedell kevinzen added a test that seems to show a problem comparing versions 58e473e
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. +4 0 spec/user_agent_spec.rb
4 spec/user_agent_spec.rb
@@ -408,6 +408,10 @@
408 408 UserAgent::Version.new("0.9").should_not >= UserAgent::Version.new("1.0")
409 409 end
410 410
  411 + it "should be >= if version is greater" do
  412 + UserAgent::Version.new("4.0b6pre").should >= UserAgent::Version.new("4.0")
  413 + end
  414 +
411 415 it "should raise ArgumentError if other is nil" do
412 416 lambda { UserAgent::Version.new("9.0").should < nil }.should raise_error(ArgumentError, "comparison of Version with nil failed")
413 417 end

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.