From e03a99a97462e48958d73ee77728b21b87f0e73e Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Tue, 28 Nov 2023 08:09:19 -0800 Subject: [PATCH] initial commits --- readnel.go | 7 +++++-- readnel_test.go | 38 +++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/readnel.go b/readnel.go index 0abe771..ef6cdb0 100644 --- a/readnel.go +++ b/readnel.go @@ -2,9 +2,12 @@ package eol import ( "io" + + "sourcecode.social/reiver/go-opt" ) func ReadNEL(runescanner io.RuneScanner) (size int, err error) { - const runeNumber = 1 - return readthisrune(runescanner, nel, runeNumber) + const characterNumber uint64 = 1 + var circumstance internalCircumstance = specifyCircumstance(opt.Something(NEL), characterNumber) + return readthisrune(circumstance, runescanner, nel) } diff --git a/readnel_test.go b/readnel_test.go index c290603..2a89339 100644 --- a/readnel_test.go +++ b/readnel_test.go @@ -67,103 +67,103 @@ func TestReadNEL_fail(t *testing.T) { }{ { Value: "", - ExpectedError: `eol: problem reading character №1 of end-of-line sequence: EOF`, + ExpectedError: `eol: problem reading character №1 of end-of-line sequence "\u0085": EOF`, }, { Value: "\n", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '\n' (U+000A)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '\n' (U+000A)`, }, { Value: "\r", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '\r' (U+000D)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '\r' (U+000D)`, }, { Value: "\u2028", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '\u2028' (U+2028)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '\u2028' (U+2028)`, }, { Value: "😈", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '😈' (U+1F608)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '😈' (U+1F608)`, }, { Value: "\napple banana cherry", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '\n' (U+000A)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '\n' (U+000A)`, }, { Value: "\rapple banana cherry", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '\r' (U+000D)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '\r' (U+000D)`, }, { Value: "\u2028apple banana cherry", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '\u2028' (U+2028)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '\u2028' (U+2028)`, }, { Value: "😈apple banana cherry", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '😈' (U+1F608)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '😈' (U+1F608)`, }, { Value: " \n", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found ' ' (U+0020)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found ' ' (U+0020)`, }, { Value: " \r", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found ' ' (U+0020)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found ' ' (U+0020)`, }, { Value: " \u0085", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found ' ' (U+0020)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found ' ' (U+0020)`, }, { Value: " \u2028", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found ' ' (U+0020)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found ' ' (U+0020)`, }, { Value: " 😈", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found ' ' (U+0020)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found ' ' (U+0020)`, }, { Value: ".\n", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '.' (U+002E)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '.' (U+002E)`, }, { Value: ".\r", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '.' (U+002E)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '.' (U+002E)`, }, { Value: ".\u0085", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '.' (U+002E)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '.' (U+002E)`, }, { Value: ".\u2028", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '.' (U+002E)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '.' (U+002E)`, }, { Value: ".😈", - ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line character №1 — instead found '.' (U+002E)`, + ExpectedError: `eol: next-line (NEL) character (U+0085) not found for end-of-line sequence "\u0085" character №1 — instead found '.' (U+002E)`, }, }