From 54668d01c76106019c3ad7183861956d42e49438 Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Fri, 8 Dec 2023 12:59:32 -0800 Subject: [PATCH] initial commits --- sp/byte.go | 4 ++-- sp/byte_test.go | 4 ++-- sp/byte_tolerant.go | 8 ++++---- sp/byte_tolerant_test.go | 4 ++-- sp/rune.go | 4 ++-- sp/rune_test.go | 4 ++-- sp/rune_tolerant.go | 8 ++++---- sp/rune_tolerant_test.go | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sp/byte.go b/sp/byte.go index d21f26d..f8f78e6 100644 --- a/sp/byte.go +++ b/sp/byte.go @@ -1,8 +1,8 @@ package sp -// ByteIsSpacing return whether the byte is a 'SP' (spacing) character, as defined by IETF RFC-2616. +// ByteIs return whether the byte is a 'SP' (spacing) character, as defined by IETF RFC-2616. // // SP = -func ByteIsSpacing(value byte) bool { +func ByteIs(value byte) bool { return ' ' == value } diff --git a/sp/byte_test.go b/sp/byte_test.go index 64c73cf..a9b4866 100644 --- a/sp/byte_test.go +++ b/sp/byte_test.go @@ -6,7 +6,7 @@ import ( "sourcecode.social/reiver/go-rfc2616/sp" ) -func TestByteIsSpacing(t *testing.T) { +func TestByteIs(t *testing.T) { tests := []struct{ Value byte @@ -1077,7 +1077,7 @@ func TestByteIsSpacing(t *testing.T) { for testNumber, test := range tests { - actual := sp.ByteIsSpacing(test.Value) + actual := sp.ByteIs(test.Value) expected := test.Expected diff --git a/sp/byte_tolerant.go b/sp/byte_tolerant.go index fc2839a..f7568a9 100644 --- a/sp/byte_tolerant.go +++ b/sp/byte_tolerant.go @@ -1,13 +1,13 @@ package sp -// ByteIsSpacingTolerant is a more tolerant version of ByteIsSpacing. -// Where ByteIsSpacing only returns whether the byte is a 'SP' (spacing) character, as defined by IETF RFC-2616: +// ByteIsTolerant is a more tolerant version of ByteIs. +// Where ByteIs only returns whether the byte is a 'SP' (spacing) character, as defined by IETF RFC-2616: // // SP = // -// ByteIsSpacingTolerant also allows: +// ByteIsTolerant also allows: // // HT = -func ByteIsSpacingTolerant(value byte) bool { +func ByteIsTolerant(value byte) bool { return ' ' == value || '\t' == value } diff --git a/sp/byte_tolerant_test.go b/sp/byte_tolerant_test.go index a0a090b..1b89dd2 100644 --- a/sp/byte_tolerant_test.go +++ b/sp/byte_tolerant_test.go @@ -6,7 +6,7 @@ import ( "sourcecode.social/reiver/go-rfc2616/sp" ) -func TestByteIsSpacingTolerant(t *testing.T) { +func TestByteIsTolerant(t *testing.T) { tests := []struct{ Value byte @@ -1077,7 +1077,7 @@ func TestByteIsSpacingTolerant(t *testing.T) { for testNumber, test := range tests { - actual := sp.ByteIsSpacingTolerant(test.Value) + actual := sp.ByteIsTolerant(test.Value) expected := test.Expected diff --git a/sp/rune.go b/sp/rune.go index 7ddb33a..2d0bf86 100644 --- a/sp/rune.go +++ b/sp/rune.go @@ -1,8 +1,8 @@ package sp -// RuneIsSpacing return whether the rune is a 'SP' (spacing) character, as defined by IETF RFC-2616. +// RuneIs return whether the rune is a 'SP' (spacing) character, as defined by IETF RFC-2616. // // SP = -func RuneIsSpacing(value rune) bool { +func RuneIs(value rune) bool { return ' ' == value } diff --git a/sp/rune_test.go b/sp/rune_test.go index 834860e..f6e16c2 100644 --- a/sp/rune_test.go +++ b/sp/rune_test.go @@ -6,7 +6,7 @@ import ( "sourcecode.social/reiver/go-rfc2616/sp" ) -func TestRuneIsSpacing(t *testing.T) { +func TestRuneIs(t *testing.T) { tests := []struct{ Value rune @@ -1077,7 +1077,7 @@ func TestRuneIsSpacing(t *testing.T) { for testNumber, test := range tests { - actual := sp.RuneIsSpacing(test.Value) + actual := sp.RuneIs(test.Value) expected := test.Expected diff --git a/sp/rune_tolerant.go b/sp/rune_tolerant.go index ecb2356..d4e734e 100644 --- a/sp/rune_tolerant.go +++ b/sp/rune_tolerant.go @@ -1,13 +1,13 @@ package sp -// RuneIsSpacingTolerant is a more tolerant version of RuneIsSpacing. -// Where RuneIsSpacing only returns whether the rune is a 'SP' (spacing) character, as defined by IETF RFC-2616: +// RuneIsTolerant is a more tolerant version of RuneIs. +// Where RuneIs only returns whether the rune is a 'SP' (spacing) character, as defined by IETF RFC-2616: // // SP = // -// RuneIsSpacingTolerant also allows: +// RuneIsTolerant also allows: // // HT = -func RuneIsSpacingTolerant(value rune) bool { +func RuneIsTolerant(value rune) bool { return ' ' == value || '\t' == value } diff --git a/sp/rune_tolerant_test.go b/sp/rune_tolerant_test.go index 649b3f7..659e1e2 100644 --- a/sp/rune_tolerant_test.go +++ b/sp/rune_tolerant_test.go @@ -6,7 +6,7 @@ import ( "sourcecode.social/reiver/go-rfc2616/sp" ) -func TestRuneIsSpacingTolerant(t *testing.T) { +func TestRuneIsTolerant(t *testing.T) { tests := []struct{ Value rune @@ -1077,7 +1077,7 @@ func TestRuneIsSpacingTolerant(t *testing.T) { for testNumber, test := range tests { - actual := sp.RuneIsSpacingTolerant(test.Value) + actual := sp.RuneIsTolerant(test.Value) expected := test.Expected