From 5a0b64f9521828b331ecec9a08d168740fe46776 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Thu, 29 May 2014 14:50:39 +0800 Subject: [PATCH] Add test script to check and size limit on string variables and filenames. --- tststr.cmd | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tststr.cmd diff --git a/tststr.cmd b/tststr.cmd new file mode 100644 index 0000000..988a4b0 --- /dev/null +++ b/tststr.cmd @@ -0,0 +1,37 @@ +; Insert long environment variables [will be truncated to NSTRING - 1 (127)] +insert-string $PATH +newline +; Insert string with escaped characters +insert-string "hello, world~n" +newline +; Insert long quoted string [will be truncated to NSTRING - 2 (126)] +insert-string "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +next-line +; Insert long tokens [will be truncated to NSTRING - 1 (127)] +insert-string 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 +next-line +insert-string _________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3 +next-line +; Create and insert string variable until size exceed string limit [will be truncated to NSTRING - 1 (127) +set %nam 123 +set %expect &len %nam +!while &equ &len %nam %expect + insert-string %nam + newline + set %nam &cat %nam %nam + set %expect &tim %expect 2 +!endwhile +insert-string %nam +newline +insert-string &cat "Actual: " &len %nam +newline +insert-string &cat "Expected: " %expect +newline +; Use the variable as filename [will be truncated to NFILEN - 1 (79)] +write-file %nam +insert-string &cat "Filename: " $cfname +newline +insert-string "Filename length: " +insert-string &len $cfname +save-file +beginning-of-file