all the old tests pass... moving on

This commit is contained in:
2026-06-02 12:48:41 -07:00
parent 5cae022b8b
commit 2c36a02331
2 changed files with 44 additions and 9 deletions
+30 -3
View File
@@ -75,8 +75,35 @@ do(Args) ->
do_doi() ->
FP = zx:get_home() ++ "/priv/doi.txt",
Cmd = "less " ++ FP,
io:format("~s~n", [Cmd]).
page_file(FP).
% thank you chatgpt
% os:cmd didnt do nuffin because that's for running
% stuff in the background and capturing the output, not
% for taking over the screen
page_file(FilePath) ->
Less = os:find_executable("less"),
case Less of
false -> cat_file(FilePath);
_ -> less_file(Less, FilePath)
end.
cat_file(FilePath) ->
{ok, Bytes} = file:read_file(FilePath),
io:format("~ts", [Bytes]).
less_file(Less, FilePath) ->
Port = open_port({spawn_executable, Less},
[{args, [FilePath]},
nouse_stdio, exit_status]),
receive
{Port, {exit_status, 0}} ->
ok;
{Port, {exit_status, N}} ->
error({less_exit_status, N});
{'EXIT', Port, Reason} ->
error(Reason)
end.
do_tests() ->
io:format("TestModules = ~p~n", [known_modules_with_prefix("ts")]),
@@ -134,7 +161,7 @@ do_eshell() ->
end.
tokenizers_agree(File) ->
so_tokens(File) =:= tokens(File).
gso_tokens(File) =:= so_tokens(File).
do_tokens(FilePath) ->