Skip to content

Commit 660eee2

Browse files
committed
Add a tests to FSTests
Confirm that for a filename with multiple dots, the .filebase method strips only the last suffix, and the .suffix method returns only the last. Signed-off-by: Mats Wichmann <[email protected]>
1 parent 01c9257 commit 660eee2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
173173
Python binary (for odd Windows setups + Python launcher)
174174
- Improve the wording of AppendENVPath and PrependENVPath in manpage.
175175
- Add more unit tests to internal AppendPath, PrependPath functions.
176+
- Add unit tests to show .filebase method strips only the last suffix if
177+
several apparent suffixes are present, and .suffix returns the last.
176178

177179

178180
RELEASE 4.9.1 - Thu, 27 Mar 2025 11:40:20 -0700

SCons/Node/FSTests.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,6 +3842,7 @@ def runTest(self) -> None:
38423842
fs = SCons.Node.FS.FS(test.workpath('work'))
38433843

38443844
f = fs.Entry('foo/bar/baz.blat').get_subst_proxy()
3845+
f2 = fs.Entry('foo/bar/baz.blat.qux').get_subst_proxy()
38453846

38463847
s = str(f.dir)
38473848
assert s == os.path.normpath('foo/bar'), s
@@ -3866,12 +3867,16 @@ def runTest(self) -> None:
38663867
assert f.filebase.is_literal(), f.filebase
38673868
for_sig = f.filebase.for_signature()
38683869
assert for_sig == 'baz.blat_filebase', for_sig
3870+
s = str(f2.filebase)
3871+
assert s == 'baz.blat', s
38693872

38703873
s = str(f.suffix)
38713874
assert s == '.blat', s
38723875
assert f.suffix.is_literal(), f.suffix
38733876
for_sig = f.suffix.for_signature()
38743877
assert for_sig == 'baz.blat_suffix', for_sig
3878+
s = str(f2.suffix)
3879+
assert s == '.qux', s
38753880

38763881
s = str(f.get_abspath())
38773882
assert s == test.workpath('work', 'foo', 'bar', 'baz.blat'), s

0 commit comments

Comments
 (0)