Skip to content

Commit

Permalink
Merge pull request #486 from rtyley/add-explicit-test-for-newline-pre…
Browse files Browse the repository at this point in the history
…servation

Add explicit test for newline-preservation
  • Loading branch information
rtyley authored Apr 26, 2023
2 parents 403e347 + 389ab05 commit 70b3ca6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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")

}

0 comments on commit 70b3ca6

Please sign in to comment.