Natools

Check-in [f3f5729400]
Login
Overview
Comment:s_expressions-file_rw_tests: update to test Open_Or_Create primitives
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f3f57294004753aee3a7435147b080e0bc60d5b8
User & Date: nat on 2017-07-10 20:33:55
Other Links: manifest | tags
Context
2019-04-08
21:24
s_expressions-enumeration_io: add a Value primitive with default check-in: a5f4c35865 user: nat tags: trunk
2017-07-10
20:33
s_expressions-file_rw_tests: update to test Open_Or_Create primitives check-in: f3f5729400 user: nat tags: trunk
2017-07-09
21:04
cron-tests: re-tune to achieve full coverage check-in: 5b22a3626b user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-file_rw_tests.adb from [1277e61ea6] to [6d3717ae0b].

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;