summaryrefslogtreecommitdiff
path: root/test/json/test_json_string_matching.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-05 11:49:39 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-05 11:49:39 +0000
commit11306587383f345d54752f262bee5f67adaae2f0 (patch)
treed63e457298a3c27b345fd674c1557e1cb390248c /test/json/test_json_string_matching.rb
parent5eff15d1bdda4efcdd8aa59c91c804e345394a1c (diff)
* ext/json/*, test/json/*: Update json-2.0.1.
Changes of 2.0.0: https://github.com/flori/json/blob/f679ebd0c69a94e3e70a897ac9a229f5779c2ee1/CHANGES.md#2015-09-11-200 Changes of 2.0.1: https://github.com/flori/json/blob/f679ebd0c69a94e3e70a897ac9a229f5779c2ee1/CHANGES.md#2016-07-01-201 [Feature #12542][ruby-dev:49706][fix GH-1395] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json/test_json_string_matching.rb')
-rw-r--r--test/json/test_json_string_matching.rb24
1 files changed, 11 insertions, 13 deletions
diff --git a/test/json/test_json_string_matching.rb b/test/json/test_json_string_matching.rb
index 6158231103..530e3644fa 100644
--- a/test/json/test_json_string_matching.rb
+++ b/test/json/test_json_string_matching.rb
@@ -1,10 +1,5 @@
-#!/usr/bin/env ruby
-# encoding: utf-8
# frozen_string_literal: false
-
-require 'test/unit'
-require File.join(File.dirname(__FILE__), 'setup_variant')
-require 'stringio'
+require 'test_helper'
require 'time'
class TestJSONStringMatching < Test::Unit::TestCase
@@ -27,14 +22,17 @@ class TestJSONStringMatching < Test::Unit::TestCase
def test_match_date
t = TestTime.new
t_json = [ t ].to_json
+ time_regexp = /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/
assert_equal [ t ],
- JSON.parse(t_json, :create_additions => true,
- :match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
- assert_equal [ t.strftime('%FT%T%z') ],
- JSON.parse(t_json, :create_additions => true,
- :match_string => { /\A\d{3}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
+ parse(
+ t_json,
+ :create_additions => true,
+ :match_string => { time_regexp => TestTime }
+ )
assert_equal [ t.strftime('%FT%T%z') ],
- JSON.parse(t_json,
- :match_string => { /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{4}\z/ => TestTime })
+ parse(
+ t_json,
+ :match_string => { time_regexp => TestTime }
+ )
end
end