Debian Codegraph @

test/com/google/javascript/jscomp/ObjectPropertyStringPostprocessTest.java

raw symbols SCIP
1 /*
2 * Copyright 2009 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 package com.google.javascript.jscomp;
19
20 /**
21 * Tests for {@link ObjectPropertyStringPostprocess}.
22 *
23 */
24 public class ObjectPropertyStringPostprocessTest extends CompilerTestCase {
25 @Override
26 protected CompilerPass getProcessor(final Compiler compiler) {
27 return new ObjectPropertyStringPostprocess(compiler);
28 }
29
30 @Override
31 protected int getNumRepetitions() {
32 return 1;
33 }
34
35 public void testFooDotBar() {
36 testPass("goog.global, foo.bar", "foo, 'bar'");
37 }
38
39 public void testFooGetElemBar() {
40 testPass("goog.global, foo[bar]", "foo, bar");
41 }
42
43 public void testFooBar() {
44 testPass("goog.global, foo$bar", "goog.global, 'foo$bar'");
45 }
46
47 private void testPass(String input, String expected) {
48 test("new JSCompiler_ObjectPropertyString(" + input + ")",
49 "new JSCompiler_ObjectPropertyString(" + expected + ")");
50 }
51 }