changeset 20527:635c93bba6b6 stable

doc: Make excplicit that asctime and ctime values end in a newline (bug #45976) * asctime.m, ctime.m: Update docstrings to show trailing newline in the returned string. Add %!tests.
author Mike Miller <mtmiller@octave.org>
date Sun, 20 Sep 2015 11:27:36 +0200
parents 6ef177ddc1ee
children 1339ad3c9faa
files scripts/time/asctime.m scripts/time/ctime.m
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/time/asctime.m	Sat Sep 19 02:34:45 2015 +0100
+++ b/scripts/time/asctime.m	Sun Sep 20 11:27:36 2015 +0200
@@ -19,14 +19,14 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} asctime (@var{tm_struct})
 ## Convert a time structure to a string using the following
-## format: @qcode{"ddd mmm mm HH:MM:SS yyyy"}.
+## format: @qcode{"ddd mmm mm HH:MM:SS yyyy@xbackslashchar{}n"}.
 ##
 ## For example:
 ##
 ## @example
 ## @group
 ## asctime (localtime (time ()))
-##      @result{} "Mon Feb 17 01:15:06 1997"
+##      @result{} "Mon Feb 17 01:15:06 1997@xbackslashchar{}n"
 ## @end group
 ## @end example
 ##
@@ -51,6 +51,8 @@
 %! t = time ();
 %! assert (strcmp (asctime (localtime (t)), ctime (t)));
 
+%!assert (asctime (localtime (time ()))(end), "\n")
+
 %!error asctime ()
 %!error asctime (1, 2)
 
--- a/scripts/time/ctime.m	Sat Sep 19 02:34:45 2015 +0100
+++ b/scripts/time/ctime.m	Sun Sep 20 11:27:36 2015 +0200
@@ -28,7 +28,7 @@
 ## @example
 ## @group
 ## ctime (time ())
-##    @result{} "Mon Feb 17 01:15:06 1997"
+##    @result{} "Mon Feb 17 01:15:06 1997@xbackslashchar{}n"
 ## @end group
 ## @end example
 ## @seealso{asctime, time, localtime}
@@ -51,6 +51,8 @@
 %! t = time ();
 %! assert (strcmp (asctime (localtime (t)), ctime (t)));
 
+%!assert (ctime (time ())(end), "\n")
+
 %!error ctime ()
 %!error ctime (1, 2)