Skip to content

Commit 5895fe9

Browse files
committed
replace '@l:c' with '(line l, col c)'
1 parent e785bc8 commit 5895fe9

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

src/Data/Formatter/Parser/Utils.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ runP ∷ ∀ s a. PS.StringLike s ⇒ Parser s a → s → Either String a
2121
runP p s = lmap printError $ runParser s (p <* PS.eof)
2222

2323
printError ParseError String
24-
printError err = parseErrorMessage err <> "@" <> (printPosition $ parseErrorPosition err)
24+
printError err = parseErrorMessage err <> " " <> (printPosition $ parseErrorPosition err)
2525

2626
printPosition Position String
27-
printPosition (Position {line, column}) = show line <> ":" <> show column
27+
printPosition (Position {line, column}) = "(line " <> show line <> ", col " <>show column <> ")"

test/src/DateTime.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ datetimeTest = describe "Data.Formatter.DateTime" do
5252

5353
describe "hour 24" do
5454
it "24 hour and more then 0 time component" $ do
55-
let err = (Left "When hour is 24, other time components must be 0@1:24")
55+
let err = (Left "When hour is 24, other time components must be 0 (line 1, col 24)")
5656
shouldEqual (FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:00:00:001") err
5757
shouldEqual (FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:00:01:000") err
5858
shouldEqual (FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:01:00:000") err
@@ -79,7 +79,7 @@ datetimeTest = describe "Data.Formatter.DateTime" do
7979
_.str
8080
"shouldn't parse"
8181
invalidDateformats
82-
(\f → (FDT.parseFormatString f.str) `shouldEqual` (Left $ "Expected EOF@" <> f.pos))
82+
(\f → (FDT.parseFormatString f.str) `shouldEqual` (Left $ "Expected EOF " <> f.pos))
8383

8484
forAll
8585
(\a → a.format <> " | " <> a.date)
@@ -116,9 +116,9 @@ dates =
116116

117117
invalidDateformats Array { str String , pos String }
118118
invalidDateformats =
119-
[ { str: "YY-h-dddd HH:mm Z", pos: "1:4" }
120-
, { str: "YYYY-MM-DD M", pos: "1:12" }
121-
, { str: "YYYYM", pos: "1:5" }
119+
[ { str: "YY-h-dddd HH:mm Z", pos: "(line 1, col 4)" }
120+
, { str: "YYYY-MM-DD M", pos: "(line 1, col 12)" }
121+
, { str: "YYYYM", pos: "(line 1, col 5)" }
122122
]
123123

124124
dateformats Array { str String , lossless Boolean, format FDT.Formatter }

test/src/Interval.purs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,50 +59,50 @@ durations =
5959

6060
invalidDurations Array { err String, str String}
6161
invalidDurations =
62-
[ { err: errInvalidISO "Hour" <> "1:13", str: "P1DT1.5H0M1S" }
63-
, { err: errInvalidISO "Year" <> "1:10", str: "P1.5Y0.5M" }
64-
, { err: errInvalidISO "Year" <> "1:8", str: "P1.5Y1M" }
65-
, { err: errInvalidISO "Month" <> "1:12", str: "P1.5MT10.5S" }
66-
, { err: errInvalidComponent <> "1:2", str: "P" }
67-
, { err: errInvalidComponent <> "1:2", str: "PW" }
68-
, { err: errInvalidComponent <> "1:2", str: "PD" }
69-
, { err: errNoTimeComponent <> "1:3", str: "PT" }
70-
, { err: errNoTimeComponent <> "1:3", str: "PTH" }
71-
, { err: errNoTimeComponent <> "1:5", str: "P1YT" }
72-
, { err: errPrefix <> "1:1", str: "" }
73-
, { err: errPrefix <> "1:1", str: "T" }
74-
, { err: errPrefix <> "1:1", str: "~P1Y" }
75-
, { err: errPrefix <> "1:1", str: ".P1Y" }
76-
, { err: errEOF <> "1:4", str: "P1Y1W" }
62+
[ { err: errInvalidISO "Hour" <> "(line 1, col 13)", str: "P1DT1.5H0M1S" }
63+
, { err: errInvalidISO "Year" <> "(line 1, col 10)", str: "P1.5Y0.5M" }
64+
, { err: errInvalidISO "Year" <> "(line 1, col 8)", str: "P1.5Y1M" }
65+
, { err: errInvalidISO "Month" <> "(line 1, col 12)", str: "P1.5MT10.5S" }
66+
, { err: errInvalidComponent <> "(line 1, col 2)", str: "P" }
67+
, { err: errInvalidComponent <> "(line 1, col 2)", str: "PW" }
68+
, { err: errInvalidComponent <> "(line 1, col 2)", str: "PD" }
69+
, { err: errNoTimeComponent <> "(line 1, col 3)", str: "PT" }
70+
, { err: errNoTimeComponent <> "(line 1, col 3)", str: "PTH" }
71+
, { err: errNoTimeComponent <> "(line 1, col 5)", str: "P1YT" }
72+
, { err: errPrefix <> "(line 1, col 1)", str: "" }
73+
, { err: errPrefix <> "(line 1, col 1)", str: "T" }
74+
, { err: errPrefix <> "(line 1, col 1)", str: "~P1Y" }
75+
, { err: errPrefix <> "(line 1, col 1)", str: ".P1Y" }
76+
, { err: errEOF <> "(line 1, col 4)", str: "P1Y1W" }
7777
]
7878
where
79-
errInvalidComponent = "Must contain valid duration components@"
80-
errPrefix = "Expected \"P\"@"
81-
errEOF = "Expected EOF@"
79+
errInvalidComponent = "Must contain valid duration components "
80+
errPrefix = "Expected \"P\" "
81+
errEOF = "Expected EOF "
8282
errInvalidISO c =
8383
"Extracted Duration is not valid ISO duration " <>
84-
"(Invalid usage of Fractional value at component `" <> c <> "`)@"
85-
errNoTimeComponent = "None of valid duration components ([\"H\",\"M\",\"S\"]) were present@"
84+
"(Invalid usage of Fractional value at component `" <> c <> "`) "
85+
errNoTimeComponent = "None of valid duration components ([\"H\",\"M\",\"S\"]) were present "
8686

8787
invalidIntervals Array {err String, str String}
8888
invalidIntervals =
89-
[ { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00ZP1Y2M10DT2H30M" }
90-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z-P1Y2M10D" }
91-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z~P1Y2M10D" }
92-
, { err: "Expected EOF@1:15", str: "P1Y2M10DT2H30M2007-03-01T13:00:00Z" }
93-
, { err: "Expected EOF@1:9", str: "P1Y2M10D-2007-03-01T13:00:00Z" }
94-
, { err: "Expected EOF@1:9", str: "P1Y2M10D~2007-03-01T13:00:00Z" }
95-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z2008-05-11T15:30:00Z" }
96-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z-2008-05-11T15:30:00Z" }
97-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z~2008-05-11T15:30:00Z" }
98-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z/" }
99-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z/P" }
100-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z/PT" }
101-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z/2010-0-09" }
102-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z/2010-05-09T103012+0400" }
103-
, { err: "Expected \"P\"@1:1", str: "2007-03-01T13:00:00Z/2014-W15-02T10:11:12Z" }
104-
, { err: "Expected EOF@1:9", str: "P1Y2M10D/P1Y2M10D" }
105-
, { err: "Expected EOF@1:8", str: "P1Y0.5M/P1Y0.5M" }
89+
[ { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00ZP1Y2M10DT2H30M" }
90+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z-P1Y2M10D" }
91+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z~P1Y2M10D" }
92+
, { err: "Expected EOF (line 1, col 15)", str: "P1Y2M10DT2H30M2007-03-01T13:00:00Z" }
93+
, { err: "Expected EOF (line 1, col 9)", str: "P1Y2M10D-2007-03-01T13:00:00Z" }
94+
, { err: "Expected EOF (line 1, col 9)", str: "P1Y2M10D~2007-03-01T13:00:00Z" }
95+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z2008-05-11T15:30:00Z" }
96+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z-2008-05-11T15:30:00Z" }
97+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z~2008-05-11T15:30:00Z" }
98+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z/" }
99+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z/P" }
100+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z/PT" }
101+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z/2010-0-09" }
102+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z/2010-05-09T103012+0400" }
103+
, { err: "Expected \"P\" (line 1, col 1)", str: "2007-03-01T13:00:00Z/2014-W15-02T10:11:12Z" }
104+
, { err: "Expected EOF (line 1, col 9)", str: "P1Y2M10D/P1Y2M10D" }
105+
, { err: "Expected EOF (line 1, col 8)", str: "P1Y0.5M/P1Y0.5M" }
106106
]
107107

108108
recurrences Array { str String, rec Maybe Int }

0 commit comments

Comments
 (0)