Skip to content

Commit

Permalink
Add tests for l3regex
Browse files Browse the repository at this point in the history
  • Loading branch information
h20y6m committed Sep 3, 2022
1 parent 27a4dcb commit e49c531
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 0 deletions.
56 changes: 56 additions & 0 deletions testfiles/pl3regex002.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
%
% Copyright (c) 2022 Japanese TeX Development Community
%
\epTeXinputencoding utf8

\input{regression-test}
\documentclass{minimal}
\RequirePackage[enable-debug]{expl3}
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation , log-functions }
\ExplSyntaxOff

\RequirePackage{plexpl3}

\begin{document}

\START
\ExplSyntaxOn

\TEST { regex_match }
{
\regex_match:nnTF { [^☃] } { ☀☁☂☃ }
{ \TRUE } { \FALSE }
\regex_match:nnTF { [^☃] } { ☃☃☃☃ }
{ \TRUE } { \FALSE }
}

\TEST { regex_count }
{
\regex_count:nnN { [^☃] } { ☀☁☂☃ } \l_tmpa_int
\TYPE { \int_use:N \l_tmpa_int }
\regex_count:nnN { [^☃] } { ☃☃☃☃ } \l_tmpa_int
\TYPE { \int_use:N \l_tmpa_int }
}

\TEST { regex_replace_once }
{
\tl_set:Nn \l_tmpa_tl { ☀☁☂☃ }
\regex_replace_once:nnN { [^☃] } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
\tl_set:Nn \l_tmpa_tl { ☃☃☃☃ }
\regex_replace_once:nnN { [^☃] } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
}

\TEST { regex_replace_all }
{
\tl_set:Nn \l_tmpa_tl { ☀☁☂☃ }
\regex_replace_all:nnN { [^☃] } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
\tl_set:Nn \l_tmpa_tl { ☃☃☃☃ }
\regex_replace_all:nnN { [^☃] } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
}

\END
26 changes: 26 additions & 0 deletions testfiles/pl3regex002.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: regex_match
============================================================
TRUE
TRUE
============================================================
============================================================
TEST 2: regex_count
============================================================
5
8
============================================================
============================================================
TEST 3: regex_replace_once
============================================================
^^e2*^^80^^e2^^98^^81^^e2^^98^^82^^e2^^98^^83
^^e2*^^83^^e2^^98^^83^^e2^^98^^83^^e2^^98^^83
============================================================
============================================================
TEST 4: regex_replace_all
============================================================
^^e2*^^80^^e2*^^81^^e2*^^82^^e2**
^^e2**^^e2**^^e2**^^e2**
============================================================
26 changes: 26 additions & 0 deletions testfiles/pl3regex002.uptex.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: regex_match
============================================================
TRUE
FALSE
============================================================
============================================================
TEST 2: regex_count
============================================================
3
0
============================================================
============================================================
TEST 3: regex_replace_once
============================================================
*☁☂☃
☃☃☃☃
============================================================
============================================================
TEST 4: regex_replace_all
============================================================
***☃
☃☃☃☃
============================================================
56 changes: 56 additions & 0 deletions testfiles/pl3regex003.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
%
% Copyright (c) 2022 Japanese TeX Development Community
%
\epTeXinputencoding utf8

\input{regression-test}
\documentclass{minimal}
\RequirePackage[enable-debug]{expl3}
\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation , log-functions }
\ExplSyntaxOff

\RequirePackage{plexpl3}

\begin{document}

\START
\ExplSyntaxOn

\TEST { regex_match }
{
\regex_match:nnTF { ± } { ±ñıűƱDZȱɱ }
{ \TRUE } { \FALSE }
\regex_match:nnTF { ± } { ñıűƱDZȱɱ }
{ \TRUE } { \FALSE }
}

\TEST { regex_count }
{
\regex_count:nnN { ± } { ±ñıűƱDZȱɱ } \l_tmpa_int
\TYPE { \int_use:N \l_tmpa_int }
\regex_count:nnN { ± } { ñıűƱDZȱɱ } \l_tmpa_int
\TYPE { \int_use:N \l_tmpa_int }
}

\TEST { regex_replace_once }
{
\tl_set:Nn \l_tmpa_tl { ±ñıűƱDZȱɱ }
\regex_replace_once:nnN { ± } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
\tl_set:Nn \l_tmpa_tl { ñıűƱDZȱɱ }
\regex_replace_once:nnN { ± } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
}

\TEST { regex_replace_all }
{
\tl_set:Nn \l_tmpa_tl { ±ñıűƱDZȱɱ }
\regex_replace_all:nnN { ± } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
\tl_set:Nn \l_tmpa_tl { ñıűƱDZȱɱ }
\regex_replace_all:nnN { ± } { * } \l_tmpa_tl
\TYPE { \tl_use:N \l_tmpa_tl }
}

\END
26 changes: 26 additions & 0 deletions testfiles/pl3regex003.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: regex_match
============================================================
TRUE
FALSE
============================================================
============================================================
TEST 2: regex_count
============================================================
1
0
============================================================
============================================================
TEST 3: regex_replace_once
============================================================
*^^c3^^b1^^c4^^b1^^c5^^b1^^c6^^b1^^c7^^b1^^c8^^b1^^c9^^b1
^^c3^^b1^^c4^^b1^^c5^^b1^^c6^^b1^^c7^^b1^^c8^^b1^^c9^^b1
============================================================
============================================================
TEST 4: regex_replace_all
============================================================
*^^c3^^b1^^c4^^b1^^c5^^b1^^c6^^b1^^c7^^b1^^c8^^b1^^c9^^b1
^^c3^^b1^^c4^^b1^^c5^^b1^^c6^^b1^^c7^^b1^^c8^^b1^^c9^^b1
============================================================
26 changes: 26 additions & 0 deletions testfiles/pl3regex003.uptex.tlg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: regex_match
============================================================
TRUE
TRUE
============================================================
============================================================
TEST 2: regex_count
============================================================
7
6
============================================================
============================================================
TEST 3: regex_replace_once
============================================================
*^^c3^^b1^^c4^^b1^^c5^^b1^^c6^^b1^^c7^^b1^^c8^^b1ɱ
^^c3*^^c4^^b1^^c5^^b1^^c6^^b1^^c7^^b1^^c8^^b1ɱ
============================================================
============================================================
TEST 4: regex_replace_all
============================================================
*^^c3*^^c4*^^c5*^^c6*^^c7*^^c8*ɱ
^^c3*^^c4*^^c5*^^c6*^^c7*^^c8*ɱ
============================================================

0 comments on commit e49c531

Please sign in to comment.