[Ruby] Fix ambiguous regex (#3716)

* ruby: Fix ambiguous regex

* ruby: Add test for strict regex
This commit is contained in:
Masahiro Saito 2016-09-05 16:37:54 +09:00 committed by wing328
parent 43bac10bb3
commit 92aa8ed767
31 changed files with 31 additions and 31 deletions

View File

@ -35,7 +35,7 @@
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -140,7 +140,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -139,7 +139,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -118,7 +118,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -145,7 +145,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -129,7 +129,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -129,7 +129,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -151,7 +151,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -148,7 +148,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -136,7 +136,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -127,7 +127,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -148,7 +148,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -171,7 +171,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -202,7 +202,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -424,7 +424,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -136,7 +136,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -159,7 +159,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -127,7 +127,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -161,7 +161,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -147,7 +147,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -136,7 +136,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -127,7 +127,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -155,7 +155,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -127,7 +127,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -208,7 +208,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -212,7 +212,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -136,7 +136,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -127,7 +127,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -136,7 +136,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -191,7 +191,7 @@ module Petstore
when :Float when :Float
value.to_f value.to_f
when :BOOLEAN when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true true
else else
false false

View File

@ -51,7 +51,7 @@ describe 'BaseObject' do
int_arr_map: {'int_arr' => [123, 456]}, int_arr_map: {'int_arr' => [123, 456]},
pet_arr_map: {'pet_arr' => [{name: 'Kitty'}]}, pet_arr_map: {'pet_arr' => [{name: 'Kitty'}]},
boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"], boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"],
boolean_false_arr: [false, "", 0, "0", "f", nil, "null"], boolean_false_arr: [false, "", 0, "0", "f", nil, "null", "\ntrue\n"],
} }
end end