summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-03-31 11:08:36 +0200
committerGitHub <noreply@github.com>2022-03-31 11:08:36 +0200
commitf9bac2a133bc825b3351e5da699dbce969957843 (patch)
tree3927e3331b4325277106c0015f049e7e6f41e319 /tests
parent98bb861553e797a3f91c199fa3b1a143bd73f33b (diff)
parente956bcf5d6533de9bbf2bbefae60c32e52348cf9 (diff)
Merge pull request #64 from dangowrt/fs-dirname-fix-off-by-one
fs: fix off-by-one in fs.dirname() function
Diffstat (limited to 'tests')
-rw-r--r--tests/custom/04_bugs/34_dirname_off_by_one16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/custom/04_bugs/34_dirname_off_by_one b/tests/custom/04_bugs/34_dirname_off_by_one
new file mode 100644
index 0000000..34ef7c7
--- /dev/null
+++ b/tests/custom/04_bugs/34_dirname_off_by_one
@@ -0,0 +1,16 @@
+Make sure fs.dirname() doesn't truncate the last character of the
+returned path. Previously ucv_string_new_length was called with a
+length which no longer included the last character (which had just
+been tested not to be a '/' or '.' and hence broke the loop at that
+point).
+
+-- Testcase --
+{%
+ fs = require('fs');
+ printf("%s\n", fs.dirname('/etc/config/wireless'));
+%}
+-- End --
+
+-- Expect stdout --
+/etc/config
+-- End --