Skip to content

Commit 7a70431

Browse files
committed
Merge branch 'compatibility' into work
2 parents 9d99a35 + 6047af0 commit 7a70431

File tree

15 files changed

+1057
-108
lines changed

15 files changed

+1057
-108
lines changed

com.eclipsesource.jshint.releng/jshint.target

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<?pde version="3.8"?>
33

4-
<target name="Running Platform + Rhino" sequenceNumber="9">
4+
<target name="Running Platform + Rhino" sequenceNumber="15">
55
<locations>
66
<location path="${eclipse_home}" type="Profile"/>
7-
<location includeAllPlatforms="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
8-
<unit id="org.hamcrest.core" version="1.1.0.v20090501071000"/>
9-
<unit id="org.hamcrest.core.source" version="1.1.0.v20090501071000"/>
10-
<unit id="org.hamcrest.integration.source" version="1.1.0.v20090501071000"/>
11-
<unit id="org.hamcrest.generator" version="1.1.0.v20090501071000"/>
12-
<unit id="org.hamcrest.generator.source" version="1.1.0.v20090501071000"/>
13-
<unit id="org.hamcrest.integration" version="1.1.0.v20090501071000"/>
14-
<unit id="org.hamcrest.library" version="1.1.0.v20090501071000"/>
15-
<unit id="org.hamcrest.library.source" version="1.1.0.v20090501071000"/>
16-
<unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
17-
<unit id="org.hamcrest.text" version="1.1.0.v20090501071000"/>
18-
<unit id="org.hamcrest.text.source" version="1.1.0.v20090501071000"/>
7+
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
198
<unit id="org.mozilla.javascript" version="1.7.2.v201005080400"/>
209
<unit id="org.mozilla.javascript.source" version="1.7.2.v201005080400"/>
21-
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20120123151124/repository/"/>
10+
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository/"/>
11+
</location>
12+
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
13+
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
14+
<unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
15+
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20120526062928/repository/"/>
16+
</location>
17+
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
18+
<unit id="org.eclipse.swtbot.forms.feature.group" version="2.0.5.20111003_1754-3676ac8-dev-e36"/>
19+
<unit id="org.eclipse.swtbot.feature.group" version="2.0.5.20111003_1754-3676ac8-dev-e36"/>
20+
<repository location="http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site"/>
2221
</location>
2322
</locations>
2423
<environment>

com.eclipsesource.jshint.ui.test/META-INF/MANIFEST.MF

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Bundle-Version: 0.9.3.qualifier
66
Bundle-Vendor: EclipseSource
77
Fragment-Host: com.eclipsesource.jshint.ui;bundle-version="0.9.3"
88
Bundle-RequiredExecutionEnvironment: J2SE-1.5
9-
Import-Package: org.hamcrest;core=split;version="1.1.0",
9+
Import-Package: org.apache.log4j;version="[1.2.13,1.3.0)",
10+
org.eclipse.swtbot.swt.finder,
11+
org.eclipse.swtbot.swt.finder.widgets,
12+
org.hamcrest;core=split;version="1.1.0",
1013
org.junit;version="4.8.2",
1114
org.junit.runner;version="4.8.2"

com.eclipsesource.jshint.ui.test/src/com/eclipsesource/jshint/ui/internal/preferences/IncludesView_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
88
* Contributors:
9-
* ralf - initial implementation and API
9+
* Ralf Sternberg initial implementation and API
1010
******************************************************************************/
1111
package com.eclipsesource.jshint.ui.internal.preferences;
1212

com.eclipsesource.jshint.ui.test/src/com/eclipsesource/jshint/ui/internal/preferences/PathEncoder_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
88
* Contributors:
9-
* ralf - initial implementation and API
9+
* Ralf Sternberg initial implementation and API
1010
******************************************************************************/
1111
package com.eclipsesource.jshint.ui.internal.preferences;
1212

com.eclipsesource.jshint.ui.test/src/com/eclipsesource/jshint/ui/internal/preferences/PathPattern_Test.java

Lines changed: 88 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
88
* Contributors:
9-
* ralf - initial implementation and API
9+
* Ralf Sternberg initial implementation and API
1010
******************************************************************************/
1111
package com.eclipsesource.jshint.ui.internal.preferences;
1212

@@ -32,12 +32,12 @@ public void emptyPattern_matchesAllFiles() {
3232
}
3333

3434
@Test
35-
public void emptyPattern_matchesAllPaths() {
35+
public void emptyPattern_matchesOnlyRoot() {
3636
PathPattern pattern = PathPattern.create( "" );
3737

3838
assertTrue( pattern.matchesFolder() );
39-
assertTrue( pattern.matchesFolder( "foo" ) );
40-
assertTrue( pattern.matchesFolder( "foo", "bar" ) );
39+
40+
assertFalse( pattern.matchesFolder( "foo" ) );
4141
}
4242

4343
@Test
@@ -70,12 +70,21 @@ public void fileOnlyPattern_matchesFile() {
7070
}
7171

7272
@Test
73-
public void fileOnlyPattern_matchesAllPaths() {
73+
public void fileOnlyPattern_matchesOnlyRoot() {
7474
PathPattern pattern = PathPattern.create( "*.js" );
7575

76-
assertTrue( pattern.matchesFolder( "" ) );
77-
assertTrue( pattern.matchesFolder( "foo" ) );
78-
assertTrue( pattern.matchesFolder( "foo", "bar" ) );
76+
assertTrue( pattern.matchesFolder() );
77+
78+
assertFalse( pattern.matchesFolder( "foo" ) );
79+
}
80+
81+
@Test
82+
public void filePatternAtRootPath_matchesOnlyRoot() {
83+
PathPattern pattern = PathPattern.create( "/*.js" );
84+
85+
assertTrue( pattern.matchesFolder() );
86+
87+
assertFalse( pattern.matchesFolder( "foo" ) );
7988
}
8089

8190
@Test
@@ -88,20 +97,19 @@ public void relativePathOnlyPattern_matchesAllFiles() {
8897
}
8998

9099
@Test
91-
public void relativePathOnlyPattern_matchesAnyPrefixPath() {
100+
public void relativePathOnlyPattern_matchesExactPath() {
92101
PathPattern pattern = PathPattern.create( "foo/" );
93102

94103
assertTrue( pattern.matchesFolder( "foo" ) );
95-
assertTrue( pattern.matchesFolder( "doo", "foo" ) );
96-
assertTrue( pattern.matchesFolder( "woo", "doo", "foo" ) );
97104

98-
assertFalse( pattern.matchesFolder( "" ) );
105+
assertFalse( pattern.matchesFolder() );
99106
assertFalse( pattern.matchesFolder( "bar" ) );
100107
assertFalse( pattern.matchesFolder( "foo", "bar" ) );
108+
assertFalse( pattern.matchesFolder( "zoo", "foo" ) );
101109
}
102110

103111
@Test
104-
public void absolutePathOnlyPattern_matchesAnyPrefixPath() {
112+
public void absolutePathOnlyPattern_matchesExactPath() {
105113
PathPattern pattern = PathPattern.create( "/foo/" );
106114

107115
assertTrue( pattern.matchesFolder( "foo" ) );
@@ -113,14 +121,14 @@ public void absolutePathOnlyPattern_matchesAnyPrefixPath() {
113121
}
114122

115123
@Test
116-
public void nestedPathOnlyPattern_matchesPath() {
124+
public void nestedPathOnlyPattern_matchesExactPath() {
117125
PathPattern pattern = PathPattern.create( "foo/bar/" );
118126

119127
assertTrue( pattern.matchesFolder( "foo", "bar" ) );
120-
assertTrue( pattern.matchesFolder( "zoo", "foo", "bar" ) );
121128

122129
assertFalse( pattern.matchesFolder( "foo" ) );
123130
assertFalse( pattern.matchesFolder( "bar" ) );
131+
assertFalse( pattern.matchesFolder( "zoo", "foo", "bar" ) );
124132
assertFalse( pattern.matchesFolder( "foo", "bar", "baz" ) );
125133
}
126134

@@ -161,6 +169,7 @@ public void wildcardSegment_isNotWildcardPath() {
161169
assertTrue( pattern.matchesFolder( "foo-bar" ) );
162170

163171
assertFalse( pattern.matchesFolder( "foo", "bar" ) );
172+
assertFalse( pattern.matchesFolder( "foo", "x", "bar" ) );
164173
}
165174

166175
@Test
@@ -174,28 +183,19 @@ public void wildcardSegment_matchesExactlyOnePathSegment() {
174183
}
175184

176185
@Test
177-
public void filePatternAtRootPath() {
178-
PathPattern pattern = PathPattern.create( "/*.foo" );
179-
180-
assertTrue( pattern.matchesFolder() );
181-
182-
assertFalse( pattern.matchesFolder( "x" ) );
183-
assertFalse( pattern.matchesFolder( "foo" ) );
184-
}
185-
186-
@Test
187-
public void tooManySlashesInARow() {
188-
assertCreateFailsWithIAE( "///foo" );
189-
assertCreateFailsWithIAE( "foo///" );
190-
assertCreateFailsWithIAE( "foo///bar" );
186+
public void tooManySuccessiveSlashes() {
187+
assertCreateFailsWithTooManySuccessiveSlashes( "///foo" );
188+
assertCreateFailsWithTooManySuccessiveSlashes( "foo///" );
189+
assertCreateFailsWithTooManySuccessiveSlashes( "foo///bar" );
191190
}
192191

193-
private static void assertCreateFailsWithIAE( String expression ) {
192+
private static void assertCreateFailsWithTooManySuccessiveSlashes( String expression ) {
194193
try {
195194
PathPattern.create( expression );
196195
fail( "Expected IllegalArgumentsException for expression " + expression );
197196
} catch( IllegalArgumentException exception ) {
198-
assertTrue( exception.getMessage().contains( "Too many slashes in a row" ) );
197+
String expected = "Too many successive slashes in expression";
198+
assertEquals( expected, exception.getMessage() );
199199
}
200200
}
201201

@@ -219,4 +219,61 @@ private static String split( String expression ) {
219219
return Arrays.toString( PathPattern.splitIntoSegmentPatterns( expression ) );
220220
}
221221

222+
@Test
223+
public void matchesAllFiles() {
224+
assertTrue( PathPattern.create( "" ).matchesAllFiles() );
225+
assertTrue( PathPattern.create( "/" ).matchesAllFiles() );
226+
assertTrue( PathPattern.create( "//" ).matchesAllFiles() );
227+
assertTrue( PathPattern.create( "src/" ).matchesAllFiles() );
228+
assertTrue( PathPattern.create( "src//" ).matchesAllFiles() );
229+
assertTrue( PathPattern.create( "*" ).matchesAllFiles() );
230+
assertTrue( PathPattern.create( "/*" ).matchesAllFiles() );
231+
assertTrue( PathPattern.create( "//*" ).matchesAllFiles() );
232+
assertTrue( PathPattern.create( "src/*" ).matchesAllFiles() );
233+
assertTrue( PathPattern.create( "src//*" ).matchesAllFiles() );
234+
235+
assertFalse( PathPattern.create( "*.*" ).matchesAllFiles() );
236+
assertFalse( PathPattern.create( "*.js" ).matchesAllFiles() );
237+
assertFalse( PathPattern.create( "src/*.js" ).matchesAllFiles() );
238+
}
239+
240+
@Test
241+
public void matchesAllFolders() {
242+
assertTrue( PathPattern.create( "//" ).matchesAllFolders() );
243+
assertTrue( PathPattern.create( "//*.js" ).matchesAllFolders() );
244+
245+
assertFalse( PathPattern.create( "" ).matchesAllFolders() );
246+
assertFalse( PathPattern.create( "/" ).matchesAllFolders() );
247+
assertFalse( PathPattern.create( "src//" ).matchesAllFolders() );
248+
assertFalse( PathPattern.create( "src//*.js" ).matchesAllFolders() );
249+
assertFalse( PathPattern.create( "//src//" ).matchesAllFolders() );
250+
assertFalse( PathPattern.create( "src//js/" ).matchesAllFolders() );
251+
}
252+
253+
@Test
254+
public void getFilePattern() {
255+
assertEquals( "*", PathPattern.create( "" ).getFilePattern() );
256+
assertEquals( "*", PathPattern.create( "/" ).getFilePattern() );
257+
assertEquals( "*", PathPattern.create( "//" ).getFilePattern() );
258+
assertEquals( "*", PathPattern.create( "src/" ).getFilePattern() );
259+
assertEquals( "*", PathPattern.create( "src/*" ).getFilePattern() );
260+
assertEquals( "*.js", PathPattern.create( "src/*.js" ).getFilePattern() );
261+
assertEquals( "foo", PathPattern.create( "//foo" ).getFilePattern() );
262+
}
263+
264+
@Test
265+
public void getPathPattern() {
266+
assertEquals( "", PathPattern.create( "" ).getPathPattern() );
267+
assertEquals( "", PathPattern.create( "file" ).getPathPattern() );
268+
assertEquals( "/", PathPattern.create( "/" ).getPathPattern() );
269+
assertEquals( "/", PathPattern.create( "/file" ).getPathPattern() );
270+
assertEquals( "//", PathPattern.create( "//" ).getPathPattern() );
271+
assertEquals( "//", PathPattern.create( "//file" ).getPathPattern() );
272+
assertEquals( "src/", PathPattern.create( "src/file" ).getPathPattern() );
273+
assertEquals( "src/", PathPattern.create( "src/*" ).getPathPattern() );
274+
assertEquals( "src//", PathPattern.create( "src//file" ).getPathPattern() );
275+
assertEquals( "src/js//", PathPattern.create( "src/js//file" ).getPathPattern() );
276+
assertEquals( "//src//js/", PathPattern.create( "//src//js/file" ).getPathPattern() );
277+
}
278+
222279
}

com.eclipsesource.jshint.ui.test/src/com/eclipsesource/jshint/ui/internal/preferences/PathSegmentPattern_Test.java

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
88
* Contributors:
9-
* ralf - initial implementation and API
9+
* Ralf Sternberg initial implementation and API
1010
******************************************************************************/
1111
package com.eclipsesource.jshint.ui.internal.preferences;
1212

@@ -149,21 +149,28 @@ public void dotInPattern_matchesOnlyDot() {
149149
}
150150

151151
@Test
152-
public void forbiddenCharacters() {
152+
public void createFailsWithIllegalCharacters() {
153153
// reserved for advanced patterns
154-
assertCreateFailsWithIAE( "!" );
155-
assertCreateFailsWithIAE( "?" );
156-
assertCreateFailsWithIAE( "+" );
157-
assertCreateFailsWithIAE( ":" );
158-
assertCreateFailsWithIAE( "|" );
159-
assertCreateFailsWithIAE( "(" );
160-
assertCreateFailsWithIAE( ")" );
161-
assertCreateFailsWithIAE( "[" );
162-
assertCreateFailsWithIAE( "]" );
163-
assertCreateFailsWithIAE( "}" );
164-
assertCreateFailsWithIAE( "{" );
154+
assertCreateFailsWithIllegalChar( '!', "!" );
155+
assertCreateFailsWithIllegalChar( '+', "+" );
156+
assertCreateFailsWithIllegalChar( ':', ":" );
157+
assertCreateFailsWithIllegalChar( '|', "|" );
158+
assertCreateFailsWithIllegalChar( '(', "(" );
159+
assertCreateFailsWithIllegalChar( ')', ")" );
160+
assertCreateFailsWithIllegalChar( '[', "[" );
161+
assertCreateFailsWithIllegalChar( ']', "]" );
162+
assertCreateFailsWithIllegalChar( '}', "}" );
163+
assertCreateFailsWithIllegalChar( '{', "{" );
165164
// file separator
166-
assertCreateFailsWithIAE( "/" );
165+
assertCreateFailsWithIllegalChar( '/', "/" );
166+
}
167+
168+
@Test
169+
public void createFailsWithIllegalCharacterInExpression() {
170+
assertCreateFailsWithIllegalChar( '!', "foo!bar" );
171+
assertCreateFailsWithIllegalChar( '/', "/foo" );
172+
assertCreateFailsWithIllegalChar( '/', "foo/" );
173+
assertCreateFailsWithIllegalChar( '[', "[foo]" );
167174
}
168175

169176
@Test
@@ -207,12 +214,13 @@ public void toString_returnsExpression() {
207214
assertEquals( "test.js", PathSegmentPattern.create( "test.js" ).toString() );
208215
}
209216

210-
private static void assertCreateFailsWithIAE( String expression ) {
217+
private static void assertCreateFailsWithIllegalChar( char illegalCharacter, String expression ) {
211218
try {
212-
PathSegmentPattern.create( ":" );
219+
PathSegmentPattern.create( expression );
213220
fail( "Expected IllegalArgumentsException for expression " + expression );
214221
} catch( IllegalArgumentException exception ) {
215-
assertTrue( exception.getMessage().contains( "Illegal character" ) );
222+
String expected = "Illegal character in expression: '" + illegalCharacter + "'";
223+
assertEquals( expected, exception.getMessage() );
216224
}
217225
}
218226

com.eclipsesource.jshint.ui.test/src/com/eclipsesource/jshint/ui/internal/preferences/ResourceSelector_Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* http://www.eclipse.org/legal/epl-v10.html
77
*
88
* Contributors:
9-
* ralf - initial implementation and API
9+
* Ralf Sternberg initial implementation and API
1010
******************************************************************************/
1111
package com.eclipsesource.jshint.ui.internal.preferences;
1212

@@ -122,7 +122,7 @@ public void allowVisitFile_parentIncluded() {
122122

123123
@Test
124124
public void allowVisitFile_fileTypeIncluded() {
125-
preferences.setIncludePatterns( list( "*.js" ) );
125+
preferences.setIncludePatterns( list( "//*.js" ) );
126126
ResourceSelector selector = new ResourceSelector( project );
127127

128128
assertTrue( selector.allowVisitFile( test_js ) );
@@ -142,7 +142,7 @@ public void allowVisitFile_directoryAndFileType() {
142142

143143
@Test
144144
public void allowVisitFile_parentExcluded() {
145-
preferences.setIncludePatterns( list( "*.js" ) );
145+
preferences.setIncludePatterns( list( "//*.js" ) );
146146
preferences.setExcludePatterns( list( "/bin/" ) );
147147
ResourceSelector selector = new ResourceSelector( project );
148148

0 commit comments

Comments
 (0)