comparison libinterp/corefcn/oct-hist.cc @ 28088:8565d950a3ca stable

allow history_timestamp_format_string to be empty (bug #57843) * oct-hist.cc (history_system::timestamp_format_string): Allow value to be empty. Add tests.
author Mike Miller <mtmiller@octave.org>
date Mon, 17 Feb 2020 23:37:12 -0800
parents c20b7290c778
children 159b6a1eb408
comparison
equal deleted inserted replaced
28085:739045a86cfd 28088:8565d950a3ca
310 octave_value 310 octave_value
311 history_system::timestamp_format_string (const octave_value_list& args, 311 history_system::timestamp_format_string (const octave_value_list& args,
312 int nargout) 312 int nargout)
313 { 313 {
314 return set_internal_variable (m_timestamp_format_string, args, nargout, 314 return set_internal_variable (m_timestamp_format_string, args, nargout,
315 "timestamp_format_string", false); 315 "timestamp_format_string");
316 } 316 }
317 317
318 // Display, save, or load history. Stolen and modified from bash. 318 // Display, save, or load history. Stolen and modified from bash.
319 // 319 //
320 // Arg of -w FILENAME means write file, arg of -r FILENAME 320 // Arg of -w FILENAME means write file, arg of -r FILENAME
882 octave::history_system& history_sys = interp.get_history_system (); 882 octave::history_system& history_sys = interp.get_history_system ();
883 883
884 return history_sys.timestamp_format_string (args, nargout); 884 return history_sys.timestamp_format_string (args, nargout);
885 } 885 }
886 886
887 /*
888 %!test
889 %! history_timestamp_format_string ("# Example history marker", "local");
890 %! assert (history_timestamp_format_string (), "# Example history marker")
891 %!test <*57843>
892 %! history_timestamp_format_string ("", "local");
893 %! assert (history_timestamp_format_string (), "")
894 */
895
887 DEFUN (history_save, args, nargout, 896 DEFUN (history_save, args, nargout,
888 doc: /* -*- texinfo -*- 897 doc: /* -*- texinfo -*-
889 @deftypefn {} {@var{val} =} history_save () 898 @deftypefn {} {@var{val} =} history_save ()
890 @deftypefnx {} {@var{old_val} =} history_save (@var{new_val}) 899 @deftypefnx {} {@var{old_val} =} history_save (@var{new_val})
891 @deftypefnx {} {} history_save (@var{new_val}, "local") 900 @deftypefnx {} {} history_save (@var{new_val}, "local")