Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | s_expressions-enumeration_io-tests: test Value of invalid enum atoms |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
b63c559d173e63b94e62fc78c88c72e2 |
| User & Date: | nat 2019-04-10 19:49:42.324 |
Context
|
2019-04-11
| ||
| 17:43 | s_expressions-generic_caches: add a cheaper-when-possible alternative to Move check-in: 60c4462e44 user: nat tags: trunk | |
|
2019-04-10
| ||
| 19:49 | s_expressions-enumeration_io-tests: test Value of invalid enum atoms check-in: b63c559d17 user: nat tags: trunk | |
|
2019-04-09
| ||
| 18:56 | s_expressions-enumeration_io: improve argument names of the new Value primitive check-in: c7fcf14363 user: nat tags: trunk | |
Changes
Changes to tests/natools-s_expressions-enumeration_io-tests.adb.
| ︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Basic_Usage (Report);
end All_Tests;
----------------------
-- Individual Tests --
----------------------
| > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
-------------------------
-- Complete Test Suite --
-------------------------
procedure All_Tests (Report : in out NT.Reporter'Class) is
begin
Basic_Usage (Report);
Invalid_Atom (Report);
end All_Tests;
----------------------
-- Individual Tests --
----------------------
|
| ︙ | ︙ | |||
60 61 62 63 64 65 66 67 |
& Stream_IO.File_Mode'Image (Expected));
end if;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Basic_Usage;
end Natools.S_Expressions.Enumeration_IO.Tests;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
& Stream_IO.File_Mode'Image (Expected));
end if;
end;
exception
when Error : others => Test.Report_Exception (Error);
end Basic_Usage;
procedure Invalid_Atom (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Value on invalid atoms");
use type Stream_IO.File_Mode;
begin
Without_Fallback :
declare
Found : Stream_IO.File_Mode;
begin
Found := Test_IO.Value (To_Atom ("invalid-atom"));
Test.Fail ("Exception expected, but Value returned "
& Stream_IO.File_Mode'Image (Found));
exception
when Constraint_Error => null;
end Without_Fallback;
With_Fallback :
declare
Expected : constant Stream_IO.File_Mode := Stream_IO.Out_File;
Found : constant Stream_IO.File_Mode
:= Test_IO.Value (To_Atom ("invalid-atom"), Expected);
begin
if Expected /= Found then
Test.Fail ("Test_IO.Value returned "
& Stream_IO.File_Mode'Image (Found)
& ", expected "
& Stream_IO.File_Mode'Image (Expected));
end if;
end With_Fallback;
exception
when Error : others => Test.Report_Exception (Error);
end Invalid_Atom;
end Natools.S_Expressions.Enumeration_IO.Tests;
|
Changes to tests/natools-s_expressions-enumeration_io-tests.ads.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 | pragma Preelaborate; package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); procedure Basic_Usage (Report : in out NT.Reporter'Class); end Natools.S_Expressions.Enumeration_IO.Tests; | > | 20 21 22 23 24 25 26 27 28 29 | pragma Preelaborate; package NT renames Natools.Tests; procedure All_Tests (Report : in out NT.Reporter'Class); procedure Basic_Usage (Report : in out NT.Reporter'Class); procedure Invalid_Atom (Report : in out NT.Reporter'Class); end Natools.S_Expressions.Enumeration_IO.Tests; |