diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-03-31 11:08:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 11:08:36 +0200 |
commit | f9bac2a133bc825b3351e5da699dbce969957843 (patch) | |
tree | 3927e3331b4325277106c0015f049e7e6f41e319 /tests | |
parent | 98bb861553e797a3f91c199fa3b1a143bd73f33b (diff) | |
parent | e956bcf5d6533de9bbf2bbefae60c32e52348cf9 (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_one | 16 |
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 -- |