Skip to content

Add explicit test for newline-preservation #486

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

Merged
merged 1 commit into from
Apr 26, 2023
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
Binary file modified bfg-library/src/test/resources/sample-repos/encodings.git.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class RepoRewriteSpec extends AnyFlatSpec with Matchers {
val filename = s"$fileNamePrefix-ORIGINAL.$fileNamePostfix"
val beforeFile = s"$parentPath/$filename"
val afterFile = s"$parentPath/$fileNamePrefix-MODIFIED-$beforeAndAfter.$fileNamePostfix"
// val dirtyFile = repo.resolve(s"master:$beforeFile")

val blobTextModifier = new BlobTextModifier {
def lineCleanerFor(entry: TreeBlobEntry) = Some(quote(before).r --> (_ => after))
Expand All @@ -146,10 +145,8 @@ class RepoRewriteSpec extends AnyFlatSpec with Matchers {
expectedFile should not be null

implicit val threadLocalObjectReader = repo.getObjectDatabase.threadLocalResources.reader()
// val dirty = dirtyFile.open.getBytes
val cleaned = cleanedFile.open.getBytes
val expected = expectedFile.open.getBytes
// val dirtyStr = new String(dirty)
val cleanedStr = new String(cleaned)
val expectedStr = new String(expected)

Expand All @@ -167,4 +164,10 @@ class RepoRewriteSpec extends AnyFlatSpec with Matchers {

it should "handle converting Windows newlines to Unix" in textReplacementOf("newlines", "windows", "txt", "\r\n", "\n")

it should "handle a file that uses LF for newlines" in
textReplacementOf("newlines", "using-LF", "txt", "file", "blob")

it should "handle a file that uses CRLF for newlines" in
textReplacementOf("newlines", "using-CRLF", "txt", "file", "blob")

}