From 388bf88d0f0d443468ab892a49dff073f13e74f7 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 22 Sep 2008 19:39:27 -0700 Subject: [PATCH] Some cleanup of printf and better docs. --- extra/printf/printf-docs.factor | 8 +++++++- extra/printf/printf-tests.factor | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/extra/printf/printf-docs.factor b/extra/printf/printf-docs.factor index fdecc2ad68..f2369a7213 100755 --- a/extra/printf/printf-docs.factor +++ b/extra/printf/printf-docs.factor @@ -39,7 +39,9 @@ HELP: sprintf { $see-also printf } ; ARTICLE: "printf" "Formatted printing" -"The " { $vocab-link "printf" } " and " { $vocab-link "sprintf" } " words are used for formatted printing.\n" +"The " { $vocab-link "printf" } " vocabulary is used for formatted printing.\n" +{ $subsection printf } +{ $subsection sprintf } "\n" "Several format specifications exist for handling arguments of different types, and specifying attributes for the result string, including such things as maximum width, padding, and decimals.\n" { $table @@ -72,3 +74,7 @@ ARTICLE: "printf" "Formatted printing" "\"%.10f\" formats a float to pad-right with zeros up to 10 digits beyond the decimal point." "\"%.5E\" formats a float into scientific notation with zeros up to 5 digits beyond the decimal point, but before the exponent." } ; + +ABOUT: "printf" + + diff --git a/extra/printf/printf-tests.factor b/extra/printf/printf-tests.factor index b365343bf0..5302048dfe 100644 --- a/extra/printf/printf-tests.factor +++ b/extra/printf/printf-tests.factor @@ -7,6 +7,10 @@ USING: kernel printf tools.test ; [ "%s" sprintf ] must-infer +[ t ] [ "" "" sprintf = ] unit-test + +[ t ] [ "asdf" "asdf" sprintf = ] unit-test + [ t ] [ "10" 10 "%d" sprintf = ] unit-test [ t ] [ "+10" 10 "%+d" sprintf = ] unit-test