You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In tests that expect multi-line strings, use a query that prints a table of (ordinal, line) pairs.
For example, the test
Sys.planEx "0";
> val it =
> "val it = let val isDept = fn d => op elem$0 (d, #depts scott) in from d_1 : {deptno:int, dname:string, loc:string} where isDept d_1 andalso #deptno d_1 = 20 yield #dname d_1 end"
> : string
should be replaced by
set ("output","tabular");
> val it = () : unit
from line in Sys.lines (Sys.planEx "0") yield {a=ordinal, line};
> a line
> - ----
> 0 val it =
> 1 let
> 2 val isDept = fn d => op elem$0 (d, #depts scott)
> 3 in
> 4 from d_1 : {deptno:int, dname:string, loc:string}
> 5 where isDept d_1
> 6 andalso #deptno d_1 = 20
> 7 yield #dname d_1
> 8 end
>
> val it : {a:int, line:string} list
Components:
The lines function breaks a string with line endings into a list
There is another function (not shown) that converts a Morel program into a Morel program formatted with whitespaces and line breaks
Because the query returns a list of records, the tabular format (added in Tabular mode #259) prints each record as a line