1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté --
-- Copyright (c) 2014-2017, Natacha Porté --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
|
288
289
290
291
292
293
294
295
296
297
298
299
|
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
To_Atom ("5:begin(()(4:head4:tail))3:end(3:foo3:bar())"),
File_Readers.Reader (To_String (Temporary_File_Name)).Read);
Test_Tools.Test_Atom
(Test,
To_Atom ("(5:first4:last)(10:unfinished"),
File_Readers.Reader (To_String (Secondary_File_Name)).Read);
end Raw_Read;
Clear_Secondary :
declare
File : Stream_IO.File_Type;
begin
Stream_IO.Open
(File, Stream_IO.Out_File, To_String (Secondary_File_Name));
Stream_IO.Delete (File);
Check_Removal :
begin
Stream_IO.Open
(File, Stream_IO.Out_File, To_String (Secondary_File_Name));
Test.Error ("Expected exception wasn't triggered.");
return;
exception
exception
when Stream_IO.Name_Error => null;
end Check_Removal;
end Clear_Secondary;
Run_Open_Or_Create :
declare
Writer : File_Writers.Writer
:= File_Writers.Open_Or_Create (To_String (Temporary_File_Name));
begin
Writer.Open_List;
Writer.Append_String ("");
Writer.Close_List;
Writer.Open_Or_Create (To_String (Secondary_File_Name));
Writer.Open_List;
Writer.Append_String ("solo");
Writer.Close_List;
end Run_Open_Or_Create;
Check_Open_Or_Create :
begin
Test_Tools.Test_Atom
(Test,
To_Atom ("5:begin(()(4:head4:tail))3:end(3:foo3:bar())(0:)"),
File_Readers.Reader (To_String (Temporary_File_Name)).Read);
Test_Tools.Test_Atom
(Test,
To_Atom ("(4:solo)"),
File_Readers.Reader (To_String (Secondary_File_Name)).Read);
end Check_Open_Or_Create;
exception
when Error : others => Test.Report_Exception (Error);
end S_Expression_IO;
end Natools.S_Expressions.File_RW_Tests;
|