Skip to content

Commit

Permalink
Bump clic dependency (#1363)
Browse files Browse the repository at this point in the history
* Bump clic dependency to include clic#27

* Add test to double-check proper UTF-8 output

* Make test not dependent on tty detection
  • Loading branch information
mosteo authored Apr 3, 2023
1 parent b4a97a1 commit f08d310
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ windows = { ALIRE_OS = "windows" }
[[pins]]
aaa = { url = "https://github.com/mosteo/aaa", commit = "906d9eaf4fb8efabfbc3d8cfb34d04ceec340e13" }
ada_toml = { url = "https://github.com/mosteo/ada-toml", commit = "da4e59c382ceb0de6733d571ecbab7ea4919b33d" }
clic = { url = "https://github.com/alire-project/clic", commit = "ce4668206bbd038e857ce6a2d463c3de9a0cc9bb" }
clic = { url = "https://github.com/alire-project/clic", commit = "8d26222de71014554999e48c821906fca0e3dc41" }
gnatcoll = { url = "https://github.com/alire-project/gnatcoll-core.git", commit = "92bb91130a9ec628b4c48b7ef9fe7f24d9dc25fa" }
semantic_versioning = { url = "https://github.com/alire-project/semantic_versioning", commit = "2f23fc5f6b4855b836b599adf292fed9c0ed4144" }
simple_logging = { url = "https://github.com/alire-project/simple_logging", commit = "3505dc645f3eef6799a486aae223d37e88cfc4d5" }
Expand Down
2 changes: 1 addition & 1 deletion deps/clic
Submodule clic updated 1 files
+4 −3 config/clic_config.gpr
22 changes: 22 additions & 0 deletions src/alr/alr-commands-dev.adb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;

with Alire.Selftest;

package body Alr.Commands.Dev is
Expand All @@ -11,6 +13,17 @@ package body Alr.Commands.Dev is
null;
end Custom;

--------------------------
-- Print_UTF_8_Sequence --
--------------------------

procedure Print_UTF_8_Sequence is
use Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
begin
-- When compiled with -gnatW8, the following should produce valid UTF-8
Trace.Always (Encode ("ⓘ✓"));
end Print_UTF_8_Sequence;

-------------
-- Execute --
-------------
Expand Down Expand Up @@ -39,6 +52,10 @@ package body Alr.Commands.Dev is
if Cmd.Self_Test then
Alire.Selftest.Run;
end if;

if Cmd.UTF_8_Test then
Print_UTF_8_Sequence;
end if;
end Execute;

----------------------
Expand Down Expand Up @@ -83,6 +100,11 @@ package body Alr.Commands.Dev is
Cmd.Self_Test'Access,
"", "--test",
"Run self-tests");

Define_Switch (Config,
Cmd.UTF_8_Test'Access,
"", "--utf8",
"Print a known UTF-8 sequence");
end Setup_Switches;

end Alr.Commands.Dev;
1 change: 1 addition & 0 deletions src/alr/alr-commands-dev.ads
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ private
Filtering : aliased Boolean := False; -- Runs debug scope filtering
Raise_Except : aliased Boolean := False;
Self_Test : aliased Boolean := False;
UTF_8_Test : aliased Boolean := False; -- Produce some UTF-8 output
end record;

end Alr.Commands.Dev;
18 changes: 18 additions & 0 deletions testsuite/tests/misc/utf8-output/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Just to be sure

"""
Verify that by default, alr prints the proper UTF-8 output
"""

from drivers.alr import init_local_crate, run_alr
from drivers.asserts import assert_eq

# Check that logging output is producing the expected valid UTF-8 output

init_local_crate()
p = run_alr("dev", "--utf8")

assert_eq("ⓘ✓\n", p.out)

print('SUCCESS')
1 change: 1 addition & 0 deletions testsuite/tests/misc/utf8-output/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
driver: python-script

0 comments on commit f08d310

Please sign in to comment.