[Mono-bugs] [Bug 25319] New - System.IO.Path.ChangeExtension incorrect in some cases

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
26 May 2002 23:04:11 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dave-mono@earth.li.

http://bugzilla.ximian.com/show_bug.cgi?id=25319

--- shadow/25319	Sun May 26 19:04:11 2002
+++ shadow/25319.tmp.4836	Sun May 26 19:04:11 2002
@@ -0,0 +1,69 @@
+Bug#: 25319
+Product: Mono/Runtime
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dave-mono@earth.li               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.IO.Path.ChangeExtension incorrect in some cases
+
+Description of Problem:
+
+System.IO.Path.ChangeExtension does not appear to 
+handle extensions containing no period. The documentation at 
+http://msdn.microsoft.com/library/default.asp?url=/library/en-
+us/cpref/html/frlrfsystemiopathclasschangeextensiontopic.asp 
+Says that it should add one, the code appears not to.
+
+Steps to reproduce the problem:
+1. Run attached test cases.
+
+Actual Results:
+Path.ChangeExtension("/foo/test.txt", "doc")
+	Expected: /foo/test.doc	Result: /foo/testdoc
+
+Path.ChangeExtension("/foo/test.txt", "")
+	Expected: /foo/test.	Result: /foo/test
+
+Path.ChangeExtension("/etc/init.d/file", "doc")
+	Expected: /etc/init.d/file.doc	Result: /etc/init.d/filedoc
+
+Path.ChangeExtension("/etc/init.d/file", "")
+	Expected: /etc/init.d/file.	Result: /etc/init.d/file
+
+Path.ChangeExtension("file.ext.txt", "doc")
+	Expected: file.ext.doc	Result: file.extdoc
+
+Path.ChangeExtension("file.ext.txt", "")
+	Expected: file.ext.	Result: file.ext
+
+Path.ChangeExtension("file", "doc")
+	Expected: file.doc	Result: filedoc
+
+Path.ChangeExtension("file", "")
+	Expected: file.	Result: file
+
+Path.ChangeExtension("/tmp/file", "doc")
+	Expected: /tmp/file.doc	Result: /tmp/filedoc
+
+Path.ChangeExtension("/tmp/file", "")
+	Expected: /tmp/file.	Result: /tmp/file
+
+Expected Results:
+No inconsistancies listed.
+
+
+Additional Information:
+Attached file doesn't compile on Linux due to bug 25276.
+I am working on converting this into a unit test, and on a patch for 
+Path.cs.
+Windows/Mac tests would be handy.