# HG changeset patch # User Mike Miller # Date 1442741256 -7200 # Node ID 635c93bba6b606090c40a9ad6e9304878a30c1a1 # Parent 6ef177ddc1ee7814b0305b24086148b961be6532 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. diff -r 6ef177ddc1ee -r 635c93bba6b6 scripts/time/asctime.m --- 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) diff -r 6ef177ddc1ee -r 635c93bba6b6 scripts/time/ctime.m --- 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)