From a8a54893c09c86e560e6fee9d7972419716dd56d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 26 Nov 2021 11:04:15 +0200 Subject: Add $size(string), $size(path), and $size(dir_path) functions --- tests/function/path/testscript | 11 +++++++++++ tests/function/string/testscript | 7 +++++++ 2 files changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/function/path/testscript b/tests/function/path/testscript index e674497..55d727f 100644 --- a/tests/function/path/testscript +++ b/tests/function/path/testscript @@ -119,6 +119,17 @@ if! $posix } } +: size +: +{ + $* <'print $size([path] abc)' >'3' : basics + $* <'print $size([path] )' >'0' : zero + + $* <'print $size([dir_path] abc)' >'3' : dir-basics + $* <'print $size([dir_path] abc/)' >'3' : dir-separator + $* <'print $size([dir_path] )' >'0' : dir-zero +} + : invalid-path : p = ($posix ? /../foo : 'c:/../foo'); diff --git a/tests/function/string/testscript b/tests/function/string/testscript index 5f80bfe..00835ce 100644 --- a/tests/function/string/testscript +++ b/tests/function/string/testscript @@ -39,3 +39,10 @@ $* <'print $sort([strings] a c b a, dedup)' >'a b c' : dedup $* <'print $sort([strings] a C B a, icase)' >'a a B C' : icase } + +: size +: +{ + $* <'print $size([string] abc)' >'3' : basics + $* <'print $size([string] )' >'0' : zero +} -- cgit v1.1