Permalink
Browse files

Added varargs test

  • Loading branch information...
ochafik committed May 1, 2012
1 parent 9ad6c3f commit 78ec24cdec911166274ea3d91487f001c61bd564
Showing with 17 additions and 0 deletions.
  1. +5 −0 Rewrites/Test.scala
  2. +12 −0 src/test/scala/scalaxy/TestsTest.scala
View
@@ -12,4 +12,9 @@ object Test
case IntConstant(888) :: Nil =>
replacement(999)
}
+
+ def replaceVarargs(fmt: String, args: Object*) = replace(
+ println(String.format(fmt, args:_*)),
+ System.out.printf(fmt + "\n", args:_*)
+ )
}
@@ -53,4 +53,16 @@ class TestsTest extends BaseTestUtils {
"""
)
}
+
+ @Test
+ def testVarargs {
+ ensurePluginCompilesSnippetsToSameByteCode(
+ """
+ println(String.format("i = %d, j = %d", 1, 2))
+ """,
+ """
+ System.out.printf("i = %d, j = %d" + "\n", 1, 2)
+ """
+ )
+ }
}

0 comments on commit 78ec24c

Please sign in to comment.