initial commits
parent
62d9ff57b4
commit
81ff90ccd8
|
@ -2,9 +2,12 @@ package eol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"sourcecode.social/reiver/go-opt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ReadCR(runescanner io.RuneScanner) (size int, err error) {
|
func ReadCR(runescanner io.RuneScanner) (size int, err error) {
|
||||||
const runeNumber = 1
|
const characterNumber uint64 = 1
|
||||||
return readthisrune(runescanner, cr, runeNumber)
|
var circumstance internalCircumstance = specifyCircumstance(opt.Something(CR), characterNumber)
|
||||||
|
return readthisrune(circumstance, runescanner, cr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,103 +67,103 @@ func TestReadCR_fail(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
Value: "",
|
Value: "",
|
||||||
ExpectedError: `eol: problem reading character №1 of end-of-line sequence: EOF`,
|
ExpectedError: `eol: problem reading character №1 of end-of-line sequence "\r": EOF`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: "\n",
|
Value: "\n",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '\n' (U+000A)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '\n' (U+000A)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: "\u0085",
|
Value: "\u0085",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '\u0085' (U+0085)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '\u0085' (U+0085)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: "\u2028",
|
Value: "\u2028",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '\u2028' (U+2028)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '\u2028' (U+2028)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: "😈",
|
Value: "😈",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '😈' (U+1F608)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '😈' (U+1F608)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: "\napple banana cherry",
|
Value: "\napple banana cherry",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '\n' (U+000A)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '\n' (U+000A)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: "\u0085apple banana cherry",
|
Value: "\u0085apple banana cherry",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '\u0085' (U+0085)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '\u0085' (U+0085)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: "\u2028apple banana cherry",
|
Value: "\u2028apple banana cherry",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '\u2028' (U+2028)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '\u2028' (U+2028)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: "😈apple banana cherry",
|
Value: "😈apple banana cherry",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '😈' (U+1F608)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '😈' (U+1F608)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: " \n",
|
Value: " \n",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found ' ' (U+0020)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found ' ' (U+0020)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: " \r",
|
Value: " \r",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found ' ' (U+0020)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found ' ' (U+0020)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: " \u0085",
|
Value: " \u0085",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found ' ' (U+0020)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found ' ' (U+0020)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: " \u2028",
|
Value: " \u2028",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found ' ' (U+0020)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found ' ' (U+0020)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: " 😈",
|
Value: " 😈",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found ' ' (U+0020)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found ' ' (U+0020)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: ".\n",
|
Value: ".\n",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '.' (U+002E)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '.' (U+002E)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: ".\r",
|
Value: ".\r",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '.' (U+002E)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '.' (U+002E)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: ".\u0085",
|
Value: ".\u0085",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '.' (U+002E)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '.' (U+002E)`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Value: ".\u2028",
|
Value: ".\u2028",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '.' (U+002E)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '.' (U+002E)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Value: ".😈",
|
Value: ".😈",
|
||||||
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line character №1 — instead found '.' (U+002E)`,
|
ExpectedError: `eol: carriage-return (CR) character ('\r') (U+000D) not found for end-of-line sequence "\r" character №1 — instead found '.' (U+002E)`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue