Flowdock
method

test_rfc2822

Importance_0
v1_9_1_378 - Show latest stable - 0 notes - Class: TimeExtentionTest
test_rfc2822() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/time.rb, line 517
    def test_rfc2822
      assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600,
                   Time.rfc2822("Fri, 21 Nov 1997 09:55:06 -0600"))
      assert_equal(Time.utc(2003, 7, 1, 10, 52, 37) - 2 * 3600,
                   Time.rfc2822("Tue, 1 Jul 2003 10:52:37 +0200"))
      assert_equal(Time.utc(1997, 11, 21, 10, 1, 10) + 6 * 3600,
                   Time.rfc2822("Fri, 21 Nov 1997 10:01:10 -0600"))
      assert_equal(Time.utc(1997, 11, 21, 11, 0, 0) + 6 * 3600,
                   Time.rfc2822("Fri, 21 Nov 1997 11:00:00 -0600"))
      assert_equal(Time.utc(1997, 11, 24, 14, 22, 1) + 8 * 3600,
                   Time.rfc2822("Mon, 24 Nov 1997 14:22:01 -0800"))
      begin
        Time.at(-1)
      rescue ArgumentError
        # ignore
      else
        assert_equal(Time.utc(1969, 2, 13, 23, 32, 54) + 3 * 3600 + 30 * 60,
                     Time.rfc2822("Thu, 13 Feb 1969 23:32:54 -0330"))
        assert_equal(Time.utc(1969, 2, 13, 23, 32, 0) + 3 * 3600 + 30 * 60,
                     Time.rfc2822(" Thu,
        13
          Feb
            1969
        23:32
                 -0330 (Newfoundland Time)"))
      end
      assert_equal(Time.utc(1997, 11, 21, 9, 55, 6),
                   Time.rfc2822("21 Nov 97 09:55:06 GMT"))
      assert_equal(Time.utc(1997, 11, 21, 9, 55, 6) + 6 * 3600,
                   Time.rfc2822("Fri, 21 Nov 1997 09 :   55  :  06 -0600"))
      assert_raise(ArgumentError) {
        # inner comment is not supported.
        Time.rfc2822("Fri, 21 Nov 1997 09(comment):   55  :  06 -0600")
      }
    end
Register or log in to add new notes.