|
From: <cr...@us...> - 2009-04-13 14:57:04
|
Revision: 5263
http://jnode.svn.sourceforge.net/jnode/?rev=5263&view=rev
Author: crawley
Date: 2009-04-13 14:56:44 +0000 (Mon, 13 Apr 2009)
Log Message:
-----------
Tests and a minor bugfix.
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/PathnamePattern.java
trunk/shell/src/test/org/jnode/test/shell/PathnamePatternTest.java
trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
Modified: trunk/shell/src/shell/org/jnode/shell/PathnamePattern.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/PathnamePattern.java 2009-04-13 13:24:06 UTC (rev 5262)
+++ trunk/shell/src/shell/org/jnode/shell/PathnamePattern.java 2009-04-13 14:56:44 UTC (rev 5263)
@@ -299,16 +299,17 @@
}
}
+ String src = source;
boolean isAbsolute;
- if (source.startsWith(File.separator)) {
- while (source.startsWith(File.separator)) {
- source = source.substring(1);
+ if (src.startsWith(File.separator)) {
+ while (src.startsWith(File.separator)) {
+ src = src.substring(1);
}
isAbsolute = true;
} else {
isAbsolute = false;
}
- String[] parts = source.split(File.separator + "+", -1);
+ String[] parts = src.split(File.separator + "+", -1);
Object[] res = new Object[parts.length];
for (int i = 0; i < parts.length; i++) {
String part = parts[i];
Modified: trunk/shell/src/test/org/jnode/test/shell/PathnamePatternTest.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/PathnamePatternTest.java 2009-04-13 13:24:06 UTC (rev 5262)
+++ trunk/shell/src/test/org/jnode/test/shell/PathnamePatternTest.java 2009-04-13 14:56:44 UTC (rev 5263)
@@ -82,6 +82,18 @@
// not incorrect. In practice, we should never encounter an empty pathname component.
assertEquals("PathnamePattern{source='*',absolute=false,pattern=['^(|[^\\.].*)$']}",
PathnamePattern.compilePathPattern("*", DF).toRegexString());
+
+ assertEquals("PathnamePattern{source='\"*\"',absolute=false,pattern=['^\\*$']}",
+ PathnamePattern.compilePathPattern("\"*\"", DF).toRegexString());
+
+ assertEquals("PathnamePattern{source='a/b',absolute=false,pattern=['a','b']}",
+ PathnamePattern.compilePathPattern("a/b", DF).toRegexString());
+
+ assertEquals("PathnamePattern{source='a/*',absolute=false,pattern=['a','^(|[^\\.].*)$']}",
+ PathnamePattern.compilePathPattern("a/*", DF).toRegexString());
+
+ assertEquals("PathnamePattern{source='/a/*',absolute=true,pattern=['a','^(|[^\\.].*)$']}",
+ PathnamePattern.compilePathPattern("/a/*", DF).toRegexString());
}
public void testExpand() {
Modified: trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-04-13 13:24:06 UTC (rev 5262)
+++ trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-04-13 14:56:44 UTC (rev 5263)
@@ -640,16 +640,6 @@
echo @TEMP_DIR@/'*'
echo "@TEMP_DIR@/*"
echo '@TEMP_DIR@/*'
- PWD=`pwd`
- # echo $PWD
- cd @TEMP_DIR@
- # pwd
- echo *
- echo \*
- echo "*"
- echo '*'
- cd $PWD
- # pwd
</script>
<file name="xyzzy" input="false">Hi mum
</file>
@@ -659,10 +649,6 @@
/tmp/jnodeTestDir/*
/tmp/jnodeTestDir/*
/tmp/jnodeTestDir/*
-xyzzy
-*
-*
-*
</output>
</testSpec>
<testSpec title="redirection" command="test" runMode="AS_SCRIPT" rc="0">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|