[latex3-commits] [git/LaTeX3-latex3-latex3] master: Correct error recovery for unary functions receiving a tuple; add tests (93b3d9e)
Bruno Le Floch
bruno at le-floch.fr
Mon Feb 12 03:02:34 CET 2018
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/93b3d9ec86f42cadc17f5acd87461979e84fc56e
>---------------------------------------------------------------
commit 93b3d9ec86f42cadc17f5acd87461979e84fc56e
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Sun Feb 11 16:16:37 2018 -0500
Correct error recovery for unary functions receiving a tuple; add tests
>---------------------------------------------------------------
93b3d9ec86f42cadc17f5acd87461979e84fc56e
l3kernel/l3fp-parse.dtx | 5 +-
l3kernel/testfiles/m3fp-parse002.lvt | 43 ++++++-
l3kernel/testfiles/m3fp-parse002.tlg | 207 ++++++++++++++++++++++++++++++++++
3 files changed, 251 insertions(+), 4 deletions(-)
diff --git a/l3kernel/l3fp-parse.dtx b/l3kernel/l3fp-parse.dtx
index 35b3a41..03cb04a 100644
--- a/l3kernel/l3fp-parse.dtx
+++ b/l3kernel/l3fp-parse.dtx
@@ -1820,8 +1820,8 @@
\@@_change_func_type:NNN #3 #1 \@@_parse_apply_unary_error:NNw
#2 #3
}
-\cs_new:Npn \@@_parse_apply_unary_error:NNw #1#2
- { \@@_invalid_operation_o:fw { \@@_func_to_name:N #1 } }
+\cs_new:Npn \@@_parse_apply_unary_error:NNw #1#2#3 @
+ { \@@_invalid_operation_o:fw { \@@_func_to_name:N #1 } #3 }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1929,7 +1929,6 @@
% in an empty tuple or tuple ending with a comma, or in an empty
% argument list or argument list ending with a comma, such as in
% |max(1,2,)| or in |rand()|.
-% ^^A TODO: test
% \begin{macrocode}
\cs_new:cpn { @@_parse_prefix_):Nw } #1
{
diff --git a/l3kernel/testfiles/m3fp-parse002.lvt b/l3kernel/testfiles/m3fp-parse002.lvt
index f12894d..e989ca3 100644
--- a/l3kernel/testfiles/m3fp-parse002.lvt
+++ b/l3kernel/testfiles/m3fp-parse002.lvt
@@ -1,5 +1,5 @@
%
-% Copyright (C) 2012-2013,2015,2017 LaTeX3 Project
+% Copyright (C) 2012-2013,2015,2017,2018 LaTeX3 Project
%
\documentclass{minimal}
@@ -143,6 +143,47 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\TEST { Saving~tuples }
+ {
+ \fp_set:Nn \l_tmpa_fp { (1,) * 3 }
+ \fp_set:Nn \l_tmpb_fp { \l_tmpa_fp }
+ \cs_if_eq:NNF \l_tmpa_fp \l_tmpb_fp { \ERROR }
+ \fp_set:Nn \l_tmpa_fp { }
+ \fp_log:n { \l_tmpa_fp , \l_tmpb_fp }
+ }
+\TESTEXP { Tuples }
+ {
+ \fp_to_tl:n { (1,2)+((1,1),2) } \NEWLINE
+ \fp_to_tl:n { (1,2)*3 } \NEWLINE
+ \fp_to_tl:n { (1,2)/4 } \NEWLINE
+ \fp_to_tl:n { 5*(1,2) } \NEWLINE
+ \fp_to_tl:n { (1,)+(2,) } \NEWLINE
+ \fp_to_tl:n { (20,(40,60),()) - (1,(2,3),()) } \NEWLINE
+ \fp_to_tl:n { - (1,(2,3),()) } \NEWLINE
+ \fp_to_tl:n { randint (1,2,3) } \NEWLINE
+ \fp_to_tl:n { (1,2,3)&&(4,5,6) } \NEWLINE
+ \fp_to_tl:n { sin((1,2),) } \NEWLINE
+ \fp_to_tl:n { atan((1,2),()) } \NEWLINE
+ \fp_to_tl:n { round((1,2),()) } \NEWLINE
+ \fp_to_tl:n { round((1,2)3) } \NEWLINE
+ % (
+ \fp_to_tl:n { 1,).(2, } \NEWLINE %)
+ \fp_to_tl:n { 1( } \NEWLINE %)
+ \fp_to_tl:n { 1(2,3 } \NEWLINE %)
+ \fp_to_tl:n { (1,2)+(3,4) } \NEWLINE
+ \fp_to_tl:n { 1, } \NEWLINE
+ \fp_to_tl:n { sin(0,) } \NEWLINE
+ \fp_to_tl:n { (1,2)^(3,4) } \NEWLINE
+ \fp_to_tl:n { 0 * (inf,1) + (inf,1) * 0 } \NEWLINE
+ }
+\TESTEXP { Tuple~conversion }
+ {
+ \fp_to_scientific:n { 1 , 2 } \NEWLINE
+ \fp_to_decimal:n { 1 , 2 } \NEWLINE
+ }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
% \TESTEXP { Indexing }
% {
% \fp_eval:n { (\1,\2\3,\4)[\0,\2][\1,\0] + \.\2 } \NEWLINE
diff --git a/l3kernel/testfiles/m3fp-parse002.tlg b/l3kernel/testfiles/m3fp-parse002.tlg
index 6e467fb..abb773d 100644
--- a/l3kernel/testfiles/m3fp-parse002.tlg
+++ b/l3kernel/testfiles/m3fp-parse002.tlg
@@ -258,3 +258,210 @@ spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
> nan123=nan.
============================================================
+============================================================
+TEST 10: Saving tuples
+============================================================
+> \l_tmpa_fp ,\l_tmpb_fp =((), (3,)).
+============================================================
+============================================================
+TEST 11: Tuples
+============================================================
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation (1)+((1, 1))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Arguments in randint(1, 2, 3) are invalid.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation ((1, 2, 3))&((4, 5, 6))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation sin((1, 2))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Arguments in atan((1, 2), ()) are invalid.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Arguments in round((1, 2), ()) are invalid.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing * inserted.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Arguments in round((3, 6),) are invalid.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Extra ) ignored.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing * inserted.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing ) inserted.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation ((0,))*((2,))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing ) inserted.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Missing ) inserted.
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation ((1, 2))^((3, 4))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation (0)*(inf)
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation (inf)*(0)
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+(nan, 4)
+(3, 6)
+(0.25, 0.5)
+(5, 10)
+(3,)
+(19, (38, 57), ())
+(-1, (-2, -3), ())
+nan
+nan
+nan
+nan
+nan
+nan
+nan
+()
+(2, 3)
+(4, 6)
+(1,)
+0
+nan
+(nan, 0)
+============================================================
+============================================================
+TEST 12: Tuple conversion
+============================================================
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation fp_to_scientific((1, 2))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+! Undefined control sequence.
+<argument> \LaTeX3 error:
+ Invalid operation fp_to_decimal((1, 2))
+l. ... }
+The control sequence at the end of the top line
+of your error message was never \def'ed. If you have
+misspelled it (e.g., `\hobx'), type `I' and the correct
+spelling (e.g., `I\hbox'). Otherwise just continue,
+and I'll forget about whatever was undefined.
+0.000000000000000e0
+0
+============================================================
More information about the latex3-commits
mailing list