diff --git a/wrangler-core/src/main/java/io/cdap/wrangler/parser/MigrateToV2.java b/wrangler-core/src/main/java/io/cdap/wrangler/parser/MigrateToV2.java index 13e07dcdf..5093a0064 100644 --- a/wrangler-core/src/main/java/io/cdap/wrangler/parser/MigrateToV2.java +++ b/wrangler-core/src/main/java/io/cdap/wrangler/parser/MigrateToV2.java @@ -56,7 +56,7 @@ public MigrateToV2(@Nullable String recipe, String delimiter) { } public MigrateToV2(String recipe) { - this(recipe, "\n"); + this(recipe, "\\r?\\n"); } /** diff --git a/wrangler-core/src/test/java/io/cdap/wrangler/parser/RecipeCompilerTest.java b/wrangler-core/src/test/java/io/cdap/wrangler/parser/RecipeCompilerTest.java index a3dab3b5d..7f8a5a157 100644 --- a/wrangler-core/src/test/java/io/cdap/wrangler/parser/RecipeCompilerTest.java +++ b/wrangler-core/src/test/java/io/cdap/wrangler/parser/RecipeCompilerTest.java @@ -167,8 +167,7 @@ public void testComplexExpression() throws Exception { "send-to-error body_5 =~ \"DC.*\"", "filter-rows-on regex-match body_5 *as*" }; - CompileStatus compile = TestingRig.compile(recipe); - Assert.assertTrue(true); + TestingRig.compileSuccess(recipe); } @Test @@ -183,8 +182,7 @@ public void test() throws Exception { "send-to-error body_5 =~ \"DC.*\"", "filter-rows-on regex-match body_5 *as*" }; - CompileStatus compile = TestingRig.compile(recipe); - Assert.assertTrue(true); + TestingRig.compileSuccess(recipe); } @Test @@ -192,8 +190,15 @@ public void testSingleLineDirectives() throws Exception { String[] recipe = new String[] { "parse-as-csv :body '\t' true; drop :body;" }; - CompileStatus compile = TestingRig.compile(recipe); - Assert.assertTrue(true); + TestingRig.compileSuccess(recipe); + } + + @Test + public void testHandlingCRLF() throws Exception { + String[] recipe = new String[] { + "parse-as-csv :body '\t' true;\r\ndrop :body;\r\n" + }; + TestingRig.compileSuccess(recipe); } @Test @@ -201,8 +206,7 @@ public void testError() throws Exception { String[] recipe = new String[] { "parse-as-abababa-csv :body '\t' true; drop :body;" }; - CompileStatus compile = TestingRig.compile(recipe); - Assert.assertTrue(true); + TestingRig.compileSuccess(recipe); } @Test