@@ -1181,6 +1181,7 @@ func Benchmark_GenericParseTypeFloats(b *testing.B) {
1181
1181
1182
1182
// go test -v -run=^$ -bench=Benchmark_GenericParseTypeBytes -benchmem -count=4
1183
1183
func Benchmark_GenericParseTypeBytes (b * testing.B ) {
1184
+ b .Skip ("Skipped: too fast to compare reliably (results in sub-ns range are unstable)" )
1184
1185
cases := []struct {
1185
1186
str string
1186
1187
err error
@@ -1228,6 +1229,7 @@ func Benchmark_GenericParseTypeBytes(b *testing.B) {
1228
1229
1229
1230
// go test -v -run=^$ -bench=Benchmark_GenericParseTypeString -benchmem -count=4
1230
1231
func Benchmark_GenericParseTypeString (b * testing.B ) {
1232
+ b .Skip ("Skipped: too fast to compare reliably (results in sub-ns range are unstable)" )
1231
1233
tests := []string {"john" , "doe" , "hello" , "fiber" }
1232
1234
1233
1235
for _ , test := range tests {
@@ -1249,6 +1251,7 @@ func Benchmark_GenericParseTypeString(b *testing.B) {
1249
1251
1250
1252
// go test -v -run=^$ -bench=Benchmark_GenericParseTypeBoolean -benchmem -count=4
1251
1253
func Benchmark_GenericParseTypeBoolean (b * testing.B ) {
1254
+ b .Skip ("Skipped: too fast to compare reliably (results in sub-ns range are unstable)" )
1252
1255
bools := []struct {
1253
1256
str string
1254
1257
value bool
@@ -1385,3 +1388,30 @@ func Test_IsEtagStale(t *testing.T) {
1385
1388
// Weak vs. weak
1386
1389
require .False (t , app .isEtagStale (`W/"a"` , []byte (`W/"a"` )))
1387
1390
}
1391
+
1392
+ func Test_App_quoteRawString (t * testing.T ) {
1393
+ t .Parallel ()
1394
+
1395
+ cases := []struct {
1396
+ name string
1397
+ in string
1398
+ out string
1399
+ }{
1400
+ {"empty" , "" , "" },
1401
+ {"simple" , "simple" , "simple" },
1402
+ {"backslash" , "A\\ B" , "A\\ \\ B" },
1403
+ {"quote" , `He said "Yo"` , `He said \"Yo\"` },
1404
+ {"newline" , "Hello\n " , "Hello\\ n" },
1405
+ {"carriage" , "Hello\r " , "Hello\\ r" },
1406
+ {"controls" , string ([]byte {0 , 31 , 127 }), "%00%1F%7F" },
1407
+ {"mixed" , "test \" A\n \r " + string ([]byte {1 }) + "\\ " , `test \"A\n\r%01\\` },
1408
+ }
1409
+
1410
+ for _ , tc := range cases {
1411
+ t .Run (tc .name , func (t * testing.T ) {
1412
+ t .Parallel ()
1413
+ app := New ()
1414
+ require .Equal (t , tc .out , app .quoteRawString (tc .in ))
1415
+ })
1416
+ }
1417
+ }
0 commit comments