Skip to main content
summaryrefslogtreecommitdiffstats
blob: 241be272476948f929aabf6b4eb95c3576ca2ac0 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*******************************************************************************
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     
 *******************************************************************************/
package org.eclipse.wst.jsdt.ui.tests.contentassist;

import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.eclipse.wst.jsdt.ui.tests.utils.TestProjectSetup;

public class NestedWithinParenthesesTests extends TestCase {
	/**
	 * <p>
	 * This tests name
	 * </p>
	 */
	private static final String TEST_NAME = "Test Insert Proposals Within Parentheses";

	/**
	 * <p>
	 * Test project setup for this test.
	 * </p>
	 */
	private static TestProjectSetup fTestProjectSetup;
	
	/**
	 * <p>
	 * Default constructor
	 * <p>
	 * <p>
	 * Use {@link #suite()}
	 * </p>
	 * 
	 * @see #suite()
	 */
	public NestedWithinParenthesesTests() {
		super(TEST_NAME);
	}

	/**
	 * <p>
	 * Constructor that takes a test name.
	 * </p>
	 * <p>
	 * Use {@link #suite()}
	 * </p>
	 * 
	 * @param name
	 *            The name this test run should have.
	 * 
	 * @see #suite()
	 */
	public NestedWithinParenthesesTests(String name) {
		super(name);
	}

	/**
	 * <p>
	 * Use this method to add these tests to a larger test suite so set up and tear down can be
	 * performed
	 * </p>
	 * 
	 * @return a {@link TestSetup} that will run all of the tests in this class
	 *         with set up and tear down.
	 */

	public static Test suite() {
		TestSuite ts = new TestSuite(NestedWithinParenthesesTests.class, TEST_NAME);
		
		fTestProjectSetup = new TestProjectSetup(ts, "ContentAssist", "root", false) {
			/**
			 * @see org.eclipse.wst.jsdt.ui.tests.contentassist.ContentAssistTestUtilities.ContentAssistTestsSetup#additionalSetUp()
			 */
			public void additionalSetUp() throws Exception {
			}
		};
		
		return fTestProjectSetup;
	}
	
	public void testInsertToEditor_315660_1() throws Exception {
		String expectedResult = 
				"var data1;\n" +
				"addEventListener(type, listener, useCapture)" ;
		ContentAssistTestUtilities.runProposalandInertTest(fTestProjectSetup, "validateTest_315660_1.js", 1, 0, expectedResult);
	}
	
	public void testInsertToEditor_315660_2() throws Exception {
		String expectedResult = 
				"var data1;\n" +
				"var data2;\n" +
				"(data1)";
		ContentAssistTestUtilities.runProposalandInertTest(fTestProjectSetup, "validateTest_315660_2.js", 2, 5, expectedResult);
	}
	
	public void testInsertToEditor_315660_3() throws Exception {
		String expectedResult = 
				"var data1;\n"+
				"var data2;\n"+
				"(\n"+
				"	// data\n"+
				"	(\n"+
				"        data1	\n"+
				"	)\n"+
				");";
		ContentAssistTestUtilities.runProposalandInertTest(fTestProjectSetup, "validateTest_315660_3.js", 5, 10, expectedResult);
	}

	public void testInsertToEditor_315660_4() throws Exception {
		String expectedResult = 
				"var data1;\n" +
				"var data2;\n" +
				"((10+data1));";
		ContentAssistTestUtilities.runProposalandInertTest(fTestProjectSetup, "validateTest_315660_4.js", 2, 7, expectedResult);
	}
	
	public void testInsertToEditor_315660_5() throws Exception {
		String expectedResult = 
				"var point = new Object();\n"+
				"point.x = 2.3;\n"+
				"point.y = -1.2;\n"+
				"var square = {upperLeft: {x:point.x, y:point.y}, upperRight: {x:(parseFloat(s))} };";
		ContentAssistTestUtilities.runProposalandInertTest(fTestProjectSetup, "validateTest_315660_5.js", 3, 66, expectedResult);
	}

}

Back to the top