Skip to content

Commit

Permalink
Tests for recent changes to \peek_analysis_map_inline:n (#1109 #1110 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
blefloch committed Oct 3, 2022
1 parent 074572f commit 9428564
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
31 changes: 30 additions & 1 deletion l3kernel/testfiles/m3peek003.lvt
@@ -1,5 +1,5 @@
%
% Copyright (C) 2020,2021 The LaTeX Project
% Copyright (C) 2020-2022 The LaTeX Project
%

\documentclass{minimal}
Expand Down Expand Up @@ -31,8 +31,37 @@
a { ~ { } \c_group_begin_token \c_space_token } X
Z { TRUE }
}

% test outer macros
\cs_set:Npn \test_if:w { \if_meaning:w \outermacro }
\outer \def \outermacro { }
\peek_analysis_map_inline:n
{
\exp_after:wN \exp_after:wN \exp_after:wN \TYPE
\exp_after:wN \exp_after:wN \exp_after:wN { \exp_after:wN \tex_meaning:D #1 , #2 , #3 }
\exp_after:wN \test_if:w #1
\exp_after:wN \peek_analysis_map_break:
\fi:
}
# \exp_after:wN \c_space_token \c_parameter_token
\outermacro
\TYPE{TRUE}
\endgroup

\cs_set_protected:Npn \test:
{
\peek_analysis_map_inline:n
{
\exp_after:wN \if_meaning:w \exp_after:wN \stop ##1
\exp_after:wN \peek_analysis_map_break:
\fi:
\TYPE { \tl_to_str:n {##1} , ##2 , ##3 }
}
\c_group_begin_token
}
\exp_after:wN \test: \exp_not:N \prg_do_nothing: \stop


% Original report from E.G.
\cs_new_eq:NN \prro \peek_regex_replace_once:nn
\ExplSyntaxOff
Expand Down
10 changes: 9 additions & 1 deletion l3kernel/testfiles/m3peek003.tlg
Expand Up @@ -12,8 +12,16 @@ a,97,B
\exp_not:n {\c_group_begin_token },-1,0
\exp_not:n {\c_space_token },-1,0
\if_false: {\fi: },125,2
\exp_not:N X,88,D
\__kernel_exp_not:w \exp_after:wN {\exp_not:N X},88,D
TRUE
============================================================
macro parameter character #,35,6
\expandafter,-1,0
blank space ,-1,0
macro parameter character #,-1,0
\outer macro:->,-1,0
TRUE
\exp_not:n {\c_group_begin_token },-1,0
\__kernel_exp_not:w \exp_after:wN {\exp_not:N \prg_do_nothing: },-1,0
Defining \prro on line ...
TRUE

0 comments on commit 9428564

Please sign in to comment.