initial commits

master
Charles Iliya Krempeaux 2023-12-08 12:59:32 -08:00
parent 4cbd01d0ee
commit 54668d01c7
8 changed files with 20 additions and 20 deletions

View File

@ -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 = <US-ASCII SP, space (32)>
func ByteIsSpacing(value byte) bool {
func ByteIs(value byte) bool {
return ' ' == value
}

View File

@ -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

View File

@ -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 = <US-ASCII SP, space (32)>
//
// ByteIsSpacingTolerant also allows:
// ByteIsTolerant also allows:
//
// HT = <US-ASCII HT, horizontal-tab (9)>
func ByteIsSpacingTolerant(value byte) bool {
func ByteIsTolerant(value byte) bool {
return ' ' == value || '\t' == value
}

View File

@ -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

View File

@ -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 = <US-ASCII SP, space (32)>
func RuneIsSpacing(value rune) bool {
func RuneIs(value rune) bool {
return ' ' == value
}

View File

@ -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

View File

@ -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 = <US-ASCII SP, space (32)>
//
// RuneIsSpacingTolerant also allows:
// RuneIsTolerant also allows:
//
// HT = <US-ASCII HT, horizontal-tab (9)>
func RuneIsSpacingTolerant(value rune) bool {
func RuneIsTolerant(value rune) bool {
return ' ' == value || '\t' == value
}

View File

@ -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