Sha256: 04be3d831cdc0c7c240f2bd05fb67fb9a1571dabd5367c31ea5328814a365967

Contents?: true

Size: 742 Bytes

Versions: 4

Compression:

Stored size: 742 Bytes

Contents

# -*- coding: utf-8 -*-
require "sixarm_ruby_range_parse_test"

describe Range do

  describe "#parse" do

    it "parses two dots as a range including the end" do
      Range.parse("a..z").must_equal "a".."z"
    end

    it "parses three dots as a range including the end" do
      Range.parse("a...z").must_equal "a"..."z"
    end

    it "calls to_s on the input" do
      x = Object.new
      def x.to_s; "a..z"; end
      Range.parse(x).must_equal "a".."z"
    end

    it "round trips" do
      range = "a".."z"
      Range.parse(range).must_equal range
    end

  end

  describe "#parse_helper" do

    it "is pass through (subclasses will override this method)" do
      Range.parse_helper("a").must_equal ("a")
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sixarm_ruby_range_parse-2.0.0 test/sixarm_ruby_range_parse_test/range_test.rb
sixarm_ruby_range_parse-1.0.5 test/sixarm_ruby_range_parse_test/range_test.rb
sixarm_ruby_range_parse-1.0.4 test/sixarm_ruby_range_parse_test/range_test.rb
sixarm_ruby_range_parse-1.0.3 test/sixarm_ruby_range_parse_test/range_test.rb