Skip to content

Commit

Permalink
test(zutil): set up test; add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
muzimuzhi committed Nov 16, 2024
1 parent 2147e15 commit 68cc21e
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
package-file: .github/tl_package
update-all-packages: true

- name: Run zutil tests
run: |
cd zutil
l3build check \
--halt-on-error--show-saves \
${{ matrix.option }}
- name: Run tabularray tests
run: |
cd tabularray
Expand Down
10 changes: 10 additions & 0 deletions zutil/testfiles/zutil-001.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\input{regression-test}
\documentclass{article}

\ExplSyntaxOn
\debug_on:n { check-declarations , check-expressions, deprecation }
\ExplSyntaxOff

\START
\usepackage{zutil}
\END
5 changes: 5 additions & 0 deletions zutil/testfiles/zutil-001.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
(zutil.sty
Package: zutil ....-..-.. v... Z's utilities, l3seq part
)
33 changes: 33 additions & 0 deletions zutil/testfiles/zutil-seq-001.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
\input{regression-test}
\documentclass{minimal}

\usepackage{zutil}

\ExplSyntaxOn

\debug_on:n { check-declarations , deprecation }

\START

% based on l3kernel test for \seq_set_split_keep_spaces:Nnn,
% from l3kernel/testfiles/m3seq004.lvt
\TEST{zutil_seq_set_split_keep_braces:Nnn}{
\zutil_seq_set_split_keep_braces:Nnn \l_tmpa_seq { | } { }
\seq_log:N \l_tmpa_seq
\zutil_seq_set_split_keep_braces:Nnn \l_tmpa_seq { , } { a, }
\seq_log:N \l_tmpa_seq
\zutil_seq_set_split_keep_braces:Nnn \l_tmpa_seq { , } { a~,~b }
\seq_log:N \l_tmpa_seq
\zutil_seq_set_split_keep_braces:Nnn \l_tmpa_seq { | }
{ ~ a | b | ~c~ | {|} | ~{~|{}~} | d ~ }
\seq_log:N \l_tmpa_seq
\zutil_seq_set_split_keep_braces:Nnn \l_tmpa_seq { ~ }
{ Hello,~world,~my~name~is~LaTeX! }
\seq_log:N \l_tmpa_seq
\zutil_seq_set_split_keep_braces:Nnn \l_tmpa_seq { } { abcdefghijklm }
\seq_log:N \l_tmpa_seq
}

\ExplSyntaxOff

\END
43 changes: 43 additions & 0 deletions zutil/testfiles/zutil-seq-001.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: zutil_seq_set_split_keep_braces:Nnn
============================================================
The sequence \l_tmpa_seq contains the items (without outer braces):
> {}.
The sequence \l_tmpa_seq contains the items (without outer braces):
> {a}
> {}.
The sequence \l_tmpa_seq contains the items (without outer braces):
> {a}
> {b}.
The sequence \l_tmpa_seq contains the items (without outer braces):
> {a}
> {b}
> {c}
> {{|}}
> {{ |{} }}
> {d}.
The sequence \l_tmpa_seq contains the items (without outer braces):
> {Hello,}
> {world,}
> {my}
> {name}
> {is}
> {LaTeX!}.
! Package zutil Error: Empty delimiter is not supported in \zutil_seq_set_split_keep_braces:Nnn .
(zutil) The existing definition of '\l_tmpa_seq ' will not be altered.
Type <return> to continue.
...
l. ...}
LaTeX does not know anything more about this error, sorry.
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
The sequence \l_tmpa_seq contains the items (without outer braces):
> {Hello,}
> {world,}
> {my}
> {name}
> {is}
> {LaTeX!}.
============================================================
12 changes: 7 additions & 5 deletions zutil/zutil.sty
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
%%
%% l3seq extras
%%
\msg_new:nnnn { zutil } { seq/empty-delimiter }
{ Empty~delimiter~is~not~supported~in~#1. }
{ I~will~skip~setting~#2. }
\msg_new:nnn { zutil } { seq/empty-delimiter }
{
Empty~delimiter~is~not~supported~in~#1. \\
The~existing~definition~of~'#2'~will~not~be~altered.
}

\cs_new_protected:Npn \zutil_seq_set_split_keep_braces:Nnn #1
{
Expand All @@ -25,8 +27,8 @@
% holds the user function, i.e. \zutil_seq_set_split_keep_braces:Nnn,
% for use in error message.
%
% l3seq internals \__seq_set_split:Nw, \__seq_set_split_end:, and
% \l__seq_internal_a_tl are used.
% l3seq internals \__seq_set_split:Nw and \l__seq_internal_a_tl, along
% with the undefined delimiter \__seq_set_split_end:, are used.
\cs_new_protected:Npn \__zutil_seq_set_split:NNNNnn #1#2#3#4#5#6
{
\tl_if_empty:nTF {#5}
Expand Down

0 comments on commit 68cc21e

Please sign in to comment.