From 052d918908b4e571a42cd3fc539933f9db139e0c Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Fri, 8 Nov 2019 03:43:49 -0500 Subject: add fs.with_suffix --- test cases/common/227 fs module/meson.build | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test cases') diff --git a/test cases/common/227 fs module/meson.build b/test cases/common/227 fs module/meson.build index 30d193fc6..fcb08c0b4 100644 --- a/test cases/common/227 fs module/meson.build +++ b/test cases/common/227 fs module/meson.build @@ -21,4 +21,17 @@ assert(not fs.is_dir('nonexisting'), 'Bad path detected as a dir.') assert(fs.is_dir('~'), 'expanduser not working') assert(not fs.is_file('~'), 'expanduser not working') +original = 'foo.txt' +new = fs.with_suffix(original, '.ini') +assert(new.endswith('foo.ini') and not new.contains('.txt'), 'with_suffix failed') + +if build_machine.system() != 'windows' + # this feature works on Windows, but `/` on windows is interpreted like `.drive` which in general may not be `c:/` + # so we omit this from self-test on Windows + + original = '/opt/foo.txt' + new = fs.with_suffix(original, '.ini') + assert(new == '/opt/foo.ini', 'absolute path with_suffix failed') +endif + subdir('subdir') -- cgit v1.2.3