From e86bb9a61ff00d139e20bf9206fba76bfff561eb Mon Sep 17 00:00:00 2001 From: Pramoth Ragavan <107881923+pramothragavan@users.noreply.github.com> Date: Wed, 29 May 2024 20:30:18 +0100 Subject: [PATCH] updated tests --- gap/io.gi | 25 ++++++++++++++++--------- tst/standard/io.tst | 15 ++++++++------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/gap/io.gi b/gap/io.gi index a01e14bbc..757429b2b 100644 --- a/gap/io.gi +++ b/gap/io.gi @@ -1399,10 +1399,11 @@ function(config, key) RemoveCharacters(tempConfig, "Ag$ntd1234567890"); if tempConfig <> "" then - ErrorNoReturn("the format of the file given as the 2nd argument ", + ErrorNoReturn("the format of the file given as the 1st argument ", "cannot be determined as it contains unexpected ", "characters: ", - tempConfig); + JoinStringsWithSeparator(tempConfig, ","), + ","); fi; Pos := PositionProperty(config, x -> x = key[1]); @@ -1486,7 +1487,8 @@ function(inputString) [currentPos + 2 .. Minimum([currentPos + 2, Length(inputString)])]} = "$" then - ErrorNoReturn("Syntax error: unexpected characters after \"$$\""); + ErrorNoReturn("Syntax error: unexpected characters", + " (including ':' or '.') after \"$$\""); else Add(segments, inputString{[startPos .. currentPos - 1]}); Add(segments, "$$"); @@ -1593,7 +1595,8 @@ function(graphData, r) RemoveCharacters(part, "."); if ForAny(parts{[iter + 1 .. Length(parts)]}, c -> ':' in c) then - ErrorNoReturn("Syntax error: unexpected characters after \".\"", + ErrorNoReturn("Syntax error: unexpected characters (including ':'", + ")after \".\"", "(note that edges cannot be declared after \".\")"); fi; fi; @@ -1604,8 +1607,9 @@ function(graphData, r) if '$' in part then if ForAny(part{[iter + 1 .. Length(part)]}, c -> c in ".:") then - ErrorNoReturn("Syntax error: unexpected characters after \"$\"", - "(note that edges cannot be declared after \"$\")"); + ErrorNoReturn("Syntax error: unexpected characters (including ':'", + "or '.')after \".\"", + "(note that edges cannot be declared after \".\")"); fi; if part = "$$" then @@ -1704,8 +1708,9 @@ function(name) file := IO_CompressedFile(UserHomeExpand(name), "r"); if file = fail then - ErrorNoReturn("cannot open the file given as the 1st argument ,", - name); + ErrorNoReturn("cannot open the file given as the 1st argument , \"", + name, + "\","); fi; config := ""; @@ -1853,7 +1858,9 @@ function(name, D) file := IO_CompressedFile(UserHomeExpand(name), "w"); if file = fail then - ErrorNoReturn("cannot open the file given as the 1st argument ,"); + ErrorNoReturn("cannot open the file given as the 1st argument , \"", + name, + "\","); fi; n := DigraphNrVertices(D); diff --git a/tst/standard/io.tst b/tst/standard/io.tst index d693474e1..e2117aa9b 100644 --- a/tst/standard/io.tst +++ b/tst/standard/io.tst @@ -927,12 +927,13 @@ gap> ReadDigraphs(filename, IO_Unpickle); gap> gr := EmptyDigraph(0);; gap> filename := "does/not/exist.dre";; gap> WriteDreadnautGraph(filename, gr); -Error, cannot open the file given as the 1st argument , +Error, cannot open the file given as the 1st argument , "does/not/exist.\ +dre", gap> WriteDreadnautGraph(filename, 0); Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `WriteDreadnautGraph' on 2 arguments gap> WriteDreadnautGraph(".", RandomDigraph(2)); -Error, cannot open the file given as the 1st argument , +Error, cannot open the file given as the 1st argument , ".", gap> filename := Concatenation(DIGRAPHS_Dir(), "tst/out/temp.dre");; gap> D := CompleteDigraph(3);; gap> WriteDreadnautGraph(filename, D); @@ -941,7 +942,7 @@ gap> WriteDreadnautGraph(filename, D); gap> ReadDreadnautGraph(filename) = D; true gap> ReadDreadnautGraph("fakedir.dre"); -Error, cannot open the file given as the 1st argument , +Error, cannot open the file given as the 1st argument , "fakedir.dre", gap> filename := Concatenation(DIGRAPHS_Dir(), "tst/out/bad.dre");; gap> file := IO_CompressedFile(UserHomeExpand(filename), "w");; gap> IO_WriteLine(file, "$1n3");; @@ -950,7 +951,7 @@ gap> IO_WriteLine(file, "1:1;");; gap> IO_WriteLine(file, "2:21");; gap> IO_Close(file);; gap> ReadDreadnautGraph(filename); -Error, Illegal edge 2 -> 21 (original indexing) + gap> filename := Concatenation(DIGRAPHS_Dir(), "tst/out/temp.dre");; gap> D := EmptyDigraph(5);; gap> WriteDreadnautGraph(filename, D);; @@ -976,9 +977,9 @@ gap> IO_WriteLine(file, "n=1dg");; gap> IO_WriteLine(file, "1: 1.");; gap> IO_Close(file);; gap> ReadDreadnautGraph(filename); -Error, the format of the file given as the 2nd argument cannot be deter\ -mined, -gap> Exec("rm -f temp.dre"); +Error, the format of the file given as the 1st argument cannot be deter\ +mined as it contains unexpected characters: 's','i','l','l','y','e','x','f','o\ +','r','e','s','i', # DIGRAPHS_UnbindVariables gap> Unbind(D);