Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes in testing and handling crlf correctly #405

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public MigrateToV2(@Nullable String recipe, String delimiter) {
}

public MigrateToV2(String recipe) {
this(recipe, "\n");
this(recipe, "\\r?\\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen recipes with \r\n in the past and they seemed to work. Were only some directives stripping the \r or something?

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -183,26 +182,31 @@ 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
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't just test that it compiles (didn't it compile successfully before?) Should test that the directives are parsed into the exact strings that are expected.

}

@Test
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
Expand Down