110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
+
|
begin
Basic_Printing (Report);
Atom_Encodings (Report);
Separators (Report);
Atom_Width (Report);
Quoted_String_Escapes (Report);
Indentation (Report);
Newline_Formats (Report);
end All_Tests;
-----------------------
-- Inidividual Tests --
-----------------------
|
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
& Latin_1.HT & Latin_1.HT & Latin_1.HT & "2:Q(" & Latin_1.LF
& Latin_1.HT & Latin_1.HT & "))end)"));
exception
when Error : others => Test.Report_Exception (Error);
end Indentation;
procedure Newline_Formats (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Newline formats");
procedure Print (Pr : in out Printer);
procedure Print (Pr : in out Printer) is
begin
Pr.Open_List;
Pr.Append_Atom (To_Atom ("begin"));
Pr.Append_Atom (To_Atom
("quoted" & Latin_1.CR & Latin_1.LF & Latin_1.CR & "str"));
Pr.Close_List;
end Print;
Param : Parameters
:= (Width => 7,
Newline_At => (others => (others => False)),
Space_At => (others => (others => False)),
Tab_Stop => 8, -- unused
Indentation => 1,
Indent => Spaces,
Quoted => When_Shorter,
Token => Standard_Token,
Hex_Casing => Encodings.Upper,
Quoted_Escape => Hex_Escape,
Char_Encoding => ASCII,
Fallback => Hexadecimal,
Newline => CR);
begin
Param.Newline_At (Atom_Data, Atom_Data) := True;
declare
Output : aliased Test_Tools.Memory_Stream;
Pr : Printer (Output'Access);
begin
Pr.Set_Parameters (Param);
Output.Set_Expected (To_Atom
("(begin" & Latin_1.CR
& " ""quot\" & Latin_1.CR
& "ed" & Latin_1.CR
& "\n" & Latin_1.CR
& "str"")"));
Print (Pr);
Check_Stream (Test, Output);
end;
Param.Newline := LF;
declare
Output : aliased Test_Tools.Memory_Stream;
Pr : Printer (Output'Access);
begin
Pr.Set_Parameters (Param);
Output.Set_Expected (To_Atom
("(begin" & Latin_1.LF
& " ""quot\" & Latin_1.LF
& "ed\r" & Latin_1.LF
& "\rstr"")"));
Print (Pr);
Check_Stream (Test, Output);
end;
Param.Newline := CR_LF;
declare
Output : aliased Test_Tools.Memory_Stream;
Pr : Printer (Output'Access);
begin
Pr.Set_Parameters (Param);
Output.Set_Expected (To_Atom
("(begin" & Latin_1.CR & Latin_1.LF
& " ""quot\" & Latin_1.CR & Latin_1.LF
& "ed" & Latin_1.CR & Latin_1.LF
& "\rstr"")"));
Print (Pr);
Check_Stream (Test, Output);
end;
Param.Newline := LF_CR;
declare
Output : aliased Test_Tools.Memory_Stream;
Pr : Printer (Output'Access);
begin
Pr.Set_Parameters (Param);
Output.Set_Expected (To_Atom
("(begin" & Latin_1.LF & Latin_1.CR
& " ""quot\" & Latin_1.LF & Latin_1.CR
& "ed\r" & Latin_1.LF & Latin_1.CR
& "str"")"));
Print (Pr);
Check_Stream (Test, Output);
end;
exception
when Error : others => Test.Report_Exception (Error);
end Newline_Formats;
procedure Quoted_String_Escapes (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Escapes in quoted string atoms");
Source : constant Atom (0 .. 123) := To_Atom
("Special: " -- indices 0 .. 17
& Latin_1.BS & Latin_1.HT & Latin_1.LF
& Latin_1.VT & Latin_1.FF & Latin_1.CR
|