blob: 5bd5da77639ff4ab7d69c01582763671c414587b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*******************************************************************************
* Copyright (c) 2008, 2016 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ua.tests.help.search;
import org.junit.Test;
public class WildcardTest {
@Test
public void testSearchWithStar() {
SearchTestUtils.searchAllLocales("jehc*qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
@Test
public void testSearchWithTwoStars() {
SearchTestUtils.searchAllLocales("jehc*qp*js", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
@Test
public void testSearchWithStarReplacingThreeChars() {
SearchTestUtils.searchAllLocales("jehc*fjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
// Test that a star does not match spaces
@Test
public void testSearchWithStarReplacingSpace() {
SearchTestUtils.searchAllLocales("jehcyqpfjs*vkrhjewiwh", new String[0]);
}
@Test
public void testSearchWithQuestionMark() {
SearchTestUtils.searchAllLocales("jehc?qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
@Test
public void testSearchWithTwoQuestionMarks() {
SearchTestUtils.searchAllLocales("j?hc?qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
@Test
public void testSearchQuestionMarkCannotReplaceTwoChars() {
SearchTestUtils.searchAllLocales("jehc?pfjs", new String[0] );
}
@Test
public void testSearchSuccessiveQuestionMarks() {
SearchTestUtils.searchAllLocales("jehc??pfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" } );
}
@Test
public void testSearchLeadingStar() {
SearchTestUtils.searchAllLocales("*hcyqpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
@Test
public void testSearchLeadingQuestionMark() {
SearchTestUtils.searchAllLocales("?ehcyqpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
}
}
|