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

Some additional unit tests for source formatter #434

Merged
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 @@ -19,6 +19,7 @@
import static org.junit.Assert.assertFalse;

import com.cognifide.aet.communication.api.metadata.ComparatorStepResult;
import com.cognifide.aet.communication.api.metadata.ComparatorStepResult.Status;
import com.cognifide.aet.job.api.comparator.ComparatorProperties;
import com.cognifide.aet.job.common.ArtifactDAOMock;
import com.cognifide.aet.job.common.comparators.AbstractComparatorTest;
Expand Down Expand Up @@ -95,6 +96,35 @@ public void testCompareMarkupWithDifferentAttributeName() throws Exception {
"markup/data-source-with-different-attribute-value.html",
ImmutableMap.of("compareType", "markup"));
assertEquals(ComparatorStepResult.Status.FAILED, result.getStatus());
}

@Test
public void shouldRecognizeLineEndings() throws Exception {
//When
result = compare("formatting/empty-lines-windows.html",
"formatting/empty-lines-linux.html",
ImmutableMap.of("compareType", "all"));
//Then
assertEquals(Status.FAILED, result.getStatus());
}

@Test
public void shouldIgnoreLineEndingsForAllFormatted() throws Exception {
//When
result = compare("formatting/empty-lines-windows.html",
"formatting/empty-lines-linux.html",
ImmutableMap.of("compareType", "allformatted"));
//Then
assertEquals(Status.PASSED, result.getStatus());
}

@Test
public void shouldIgnoreWhitespacesForAllFormatted() throws Exception {
//When
result = compare("formatting/formatted.html",
"formatting/not-formatted.html",
ImmutableMap.of("compareType", "allformatted"));
//Then
assertEquals(Status.PASSED, result.getStatus());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>


<div>
<span>zażółć</span>

</div>


</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>


<div>
<span>zażółć</span>

</div>


</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div>
<span>zażółć</span>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>

<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>

<div>


<span>zażółć</span>


</div>
</body>
</html>