Skip to content

Commit

Permalink
Add another test to make sure casts aren't removed.
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133434886
  • Loading branch information
tbreisacher authored and blickly committed Sep 19, 2016
1 parent 78dcaf6 commit 6c9af76
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/com/google/javascript/refactoring/SuggestedFixTest.java
Expand Up @@ -448,7 +448,7 @@ public void testInsertArguments_lastArgument() {
}

@Test
public void testInsertArguments_castInArguments() {
public void testInsertArguments_beforeCastInArguments() {
String originalCode = "goog.dom.classes.add(foo, /** @type {String} */ (bar));";
String expectedCode = "goog.dom.classes.add(foo, baz, /** @type {String} */ (bar));";
Compiler compiler = getCompiler(originalCode);
Expand All @@ -459,6 +459,18 @@ public void testInsertArguments_castInArguments() {
assertChanges(fix, "", originalCode, expectedCode);
}

@Test
public void testInsertArguments_afterCastInArguments() {
String originalCode = "goog.dom.classes.add(foo, /** @type {String} */ (bar));";
String expectedCode = "goog.dom.classes.add(foo, /** @type {String} */ (bar), baz);";
Compiler compiler = getCompiler(originalCode);
Node root = compileToScriptRoot(compiler);
SuggestedFix fix = new SuggestedFix.Builder()
.insertArguments(root.getFirstFirstChild(), 2, "baz")
.build();
assertChanges(fix, "", originalCode, expectedCode);
}

@Test
public void testDeleteArgumentFirst() {
String originalCode = "f(a, b, c);";
Expand Down

0 comments on commit 6c9af76

Please sign in to comment.