Skip to content

Commit

Permalink
Add tests for \text_titlecase_first:n
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Dec 7, 2019
1 parent fca2348 commit 0ca6a45
Show file tree
Hide file tree
Showing 6 changed files with 294 additions and 74 deletions.
75 changes: 59 additions & 16 deletions l3kernel/testfiles/m3text002.luatex.tlg
Expand Up @@ -7,86 +7,116 @@ TEST 1: Basic case changing
hello world \par with \ERROR &##
HELLO WORLD \par WITH \ERROR &##
Hello world \par with \ERROR &##
Hello world \par with \ERROR &##
============================================================
============================================================
TEST 2: Case changes in braces
============================================================
{hello} world \par with \ERROR &##
{HELLO} WORLD \par WITH \ERROR &##
{Hello} world \par with \ERROR &##
{Hello} world \par with \ERROR &##
============================================================
============================================================
TEST 3: Titlecase basics
============================================================
Hello world
Hello world
Hello world
HELLO WORLD
" Hello world"
" Hello world"
" Hello world"
" HELLO WORLD"
{H}ello world
{H}ello world
{H}ello world
{H}ELLO WORLD
{}helloworld
{}helloworld
{}helloworld
{}helloworld
============================================================
============================================================
TEST 4: Titlecase skipping chars
============================================================
`Hic sunt leones'
`Hic sunt leones'
``Hic sunt leones''
``Hic sunt leones''
([Hic sunt leones])
([Hic sunt leones])
============================================================
============================================================
TEST 5: Language based case changing but nothing
TEST 5: Titlecase first
============================================================
`Hic sunt leones'
`Hic SUNT leones'
`Hic sunt leones'
`HIC SUNT leones'
E pluribus unum
E PLURIBUS UNUM
============================================================
============================================================
TEST 6: Language based case changing but nothing
============================================================
no problems
NO PROBLEMS
No problems
No problems
no problems
NO PROBLEMS
No problems
No problems
============================================================
============================================================
TEST 6: Unicode case changing
TEST 7: Unicode case changing
============================================================
^^e5^^e9^^ee^^f8ὥдαɛ
^^c5^^c9^^ce^^d8ὭДΑƐ
^^c5^^e9^^ee^^f8ὥдαɛ
^^c5^^e9^^ee^^f8ὭдαƐ
============================================================
============================================================
TEST 7: Unicode case changing exceptions
TEST 8: Unicode case changing exceptions
============================================================
fu^^dfball
FUSSBALL
Fu^^dfball
Fu^^dfball
============================================================
============================================================
TEST 8: The final sigma rule
TEST 9: The final sigma rule
============================================================
ὀδυσσεύς (ὀδυσσεύς) ὀδυσσεύς, ὀδυσσεύς{}
ὀδυσσεύς\noop
ὈΔΥΣΣΕΎΣ (ὈΔΥΣΣΕΎΣ) ὈΔΥΣΣΕΎΣ, ὈΔΥΣΣΕΎΣ{}
ὈΔΥΣΣΕΎΣ\noop
Ὀδυσσεύς (ὀδυσσεύς) ὀδυσσεύς, ὀδυσσεύς{}
ὀδυσσεύς\noop
ὈΔΥΣΣΕΎΣ (ὈΔΥΣΣΕΎΣ) ὈΔΥΣΣΕΎΣ, ὈΔΥΣΣΕΎΣ{}
ὈΔΥΣΣΕΎΣ\noop
ὀδυσσεύς
ὈΔΥΣΣΕΎΣ
Ὀδυσσεύς
ὈΔΥΣΣΕΎΣ
============================================================
============================================================
TEST 9: German-alternative
TEST 10: German-alternative
============================================================
FUSSBALL
FUẞBALL
============================================================
============================================================
TEST 10: Greek
TEST 11: Greek
============================================================
ὈΔΥΣΣΕΎΣ
ΟΔΥΣΣΕΥΣ
Ὀδυσσεύς
Ὀδυσσεύς
============================================================
============================================================
TEST 11: Turkish/Azeri
TEST 12: Turkish/Azeri
============================================================
ragıp hul^^fbsi ^^f6zdem
ragip hul^^fbsi̇ ^^f6zdem
Expand All @@ -98,7 +128,7 @@ Ip hul^^fbsi ^^f6zdem
Ip hul^^fbsi ^^f6zdem
============================================================
============================================================
TEST 12: Lithuanian
TEST 13: Lithuanian
============================================================
i̇̀i̇́i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃
^^ec^^edĩìíĩj̀j́j̃į̀į́į̃
Expand All @@ -110,7 +140,7 @@ Ìi̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃
İ̀i̇̀i̇̃i̇̀i̇́i̇̃j̇̀j̇́j̇̃į̇̀į̇́į̇̃
============================================================
============================================================
TEST 13: Dutch
TEST 14: Dutch
============================================================
ijsselmeer
ijsselmeer
Expand All @@ -126,75 +156,88 @@ Im
Im
============================================================
============================================================
TEST 14: Titlecase exceptions
TEST 15: Titlecase exceptions
============================================================
Ssoo
Dž!
============================================================
============================================================
TEST 15: Case changing braced arguments
TEST 16: Case changing braced arguments
============================================================
foo \emph {BAR} {baz}
FOO \emph {BAR} {BAZ}
Foo \emph {BAR} {baz}
FOO \emph {BAR} {BAZ}
\emph {BAR} {baz}
\emph {BAR} {BAZ}
\emph {BAR} {Baz}
\emph {BAR} {BAZ}
============================================================
============================================================
TEST 16: Expanding content
TEST 17: Expanding content
============================================================
some text hello
SOME TEXT HELLO
Some text hello
Some text Hello
hello sometext
HELLO SOMETEXT
Hello sometext
Hello sometext
some text hello
SOME TEXT HELLO
Some text hello
Some text Hello
hello sometext
HELLO SOMETEXT
Hello sometext
Hello sometext
some text \cs_tmp:w
SOME TEXT \cs_tmp:w
Some text \cs_tmp:w
Some text \cs_tmp:w
\cs_tmp:w sometext
\cs_tmp:w SOMETEXT
\cs_tmp:w Sometext
\cs_tmp:w Sometext
============================================================
============================================================
TEST 17: Math-mode escape
TEST 18: Math-mode escape
============================================================
some text $y = mx + c$
SOME TEXT $y = mx + c$
Some text $y = mx + c$
Some text $y = mx + c$
$y = mx + c$ text
$y = mx + c$ TEXT
$y = mx + c$ Text
$y = mx + c$ Text
opps not close token in $y = mx + c
OPPS NOT CLOSE TOKEN IN $y = mx + c
Opps not close token in $y = mx + c
Opps not close token in $y = mx + c
============================================================
============================================================
TEST 18: Nesting
TEST 19: Nesting
============================================================
HELLO
hello
FUSSBALL
ὈΔΥΣΣΕΎΣ
============================================================
============================================================
TEST 19: Letter-like commands
TEST 20: Letter-like commands
============================================================
\aa \aa \J \ae \dh \ss \l \o
\AA \AA \J \AE \DH \SS \L \O
\AA \aa \J \ae \dh \ss \l \o
\AA \aa \J \ae \dh \ss \l \O
============================================================
============================================================
TEST 20: Accents
TEST 21: Accents
============================================================
\"{a}\u {e}\H {i}\v {o}\.{u}
\"{A}\u {E}\H {I}\v {O}\.{U}
\"{A}\u {e}\H {i}\v {o}\.{u}
\"{A}\u {e}\H {i}\v {o}\.{u}
============================================================
43 changes: 34 additions & 9 deletions l3kernel/testfiles/m3text002.lvt
Expand Up @@ -20,6 +20,8 @@
\text_uppercase:n {#1}
\NEWLINE
\text_titlecase:n {#1}
\NEWLINE
\text_titlecase_first:n {#1}
}
\cs_set:Npn \test:nn #1#2
{
Expand All @@ -28,6 +30,8 @@
\text_uppercase:nn {#1} {#2}
\NEWLINE
\text_titlecase:nn {#1} {#2}
\NEWLINE
\text_titlecase_first:nn {#1} {#2}
}
\TIMO

Expand All @@ -41,33 +45,54 @@
\test:n { {Hello}~world~\par with~\ERROR & # }
}

\OMIT
\cs_set:Npn \testii:n #1
{
\text_titlecase:n {#1}
\NEWLINE
\text_titlecase_first:n {#1}
}
\TIMO

\TESTEXP { Titlecase~basics }
{
\text_titlecase:n { hello~world }
\testii:n { hello~world }
\NEWLINE
\text_titlecase:n { HELLO~WORLD }
\testii:n { HELLO~WORLD }
\NEWLINE
"\text_titlecase:n { ~hello~world }"
\NEWLINE
"\text_titlecase_first:n { ~hello~world }"
\NEWLINE
"\text_titlecase:n { ~HELLO~WORLD }"
\NEWLINE
\text_titlecase:n { {h}ello~world }
"\text_titlecase_first:n { ~HELLO~WORLD }"
\NEWLINE
\text_titlecase:n { {H}ELLO~WORLD }
\testii:n { {h}ello~world }
\NEWLINE
\text_titlecase:n { { } hello world }
\testii:n { {H}ELLO~WORLD }
\NEWLINE
\text_titlecase:n { { \prg_do_nothing: } hello world }
\testii:n { { } hello world }
\NEWLINE
\testii:n { { \prg_do_nothing: } hello world }
}

\TESTEXP { Titlecase~skipping~chars }
{
\text_titlecase:n { `hic~sunt~leones' }
\testii:n { `hic~sunt~leones' }
\NEWLINE
\testii:n { ``hic~sunt~leones'' }
\NEWLINE
\text_titlecase:n { ``hic~sunt~leones'' }
\testii:n { ([hic~sunt~leones]) }
}

\TESTEXP { Titlecase~first }
{
\testii:n { `hic~SUNT~leones' }
\NEWLINE
\text_titlecase:n { ([hic~sunt~leones]) }
\testii:n { `HIC~SUNT~leones' }
\NEWLINE
\testii:n { E~PLURIBUS~UNUM }
}

\TESTEXP { Language~based~case~changing~but~nothing }
Expand Down
27 changes: 26 additions & 1 deletion l3kernel/testfiles/m3text002.ptex.tlg
Expand Up @@ -7,40 +7,65 @@ TEST 1: Basic case changing
hello world \par with \ERROR &##
HELLO WORLD \par WITH \ERROR &##
Hello world \par with \ERROR &##
Hello world \par with \ERROR &##
============================================================
============================================================
TEST 2: Case changes in braces
============================================================
{hello} world \par with \ERROR &##
{HELLO} WORLD \par WITH \ERROR &##
{Hello} world \par with \ERROR &##
{Hello} world \par with \ERROR &##
============================================================
============================================================
TEST 3: Titlecase basics
============================================================
Hello world
Hello world
Hello world
HELLO WORLD
" Hello world"
" Hello world"
" Hello world"
" HELLO WORLD"
{H}ello world
{H}ello world
{H}ello world
{H}ELLO WORLD
{}helloworld
{}helloworld
{}helloworld
{}helloworld
============================================================
============================================================
TEST 4: Titlecase skipping chars
============================================================
`Hic sunt leones'
`Hic sunt leones'
``Hic sunt leones''
``Hic sunt leones''
([Hic sunt leones])
([Hic sunt leones])
============================================================
============================================================
TEST 5: Titlecase first
============================================================
`Hic sunt leones'
`Hic SUNT leones'
`Hic sunt leones'
`HIC SUNT leones'
E pluribus unum
E PLURIBUS UNUM
============================================================
============================================================
TEST 5: Language based case changing but nothing
TEST 6: Language based case changing but nothing
============================================================
no problems
NO PROBLEMS
No problems
No problems
no problems
NO PROBLEMS
No problems
No problems
============================================================

0 comments on commit 0ca6a45

Please sign in to comment.