This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Laura Cameran
committed
Sep 3, 2020
1 parent
fa3b325
commit 094272d
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ch.mibex.bitbucket.sonar | ||
|
||
import ch.mibex.bitbucket.sonar.diff.GitDiffParser | ||
import java.io.File | ||
import scala.io.Source | ||
|
||
object ParserTest { | ||
def main(args: Array[String]): Unit = { | ||
val fileToRead = new File("D:/tmp/sonar-plugin tests/september-2020/log_diff_mufggps.txt") | ||
//println("File path: " + fileToRead.toString) | ||
//val fileContents = Source.fromFile(fileToRead).mkString | ||
val fileContents = Source.fromFile(fileToRead, "UTF-8").mkString | ||
//println(fileContents) | ||
GitDiffParser.parse(fileContents) match { | ||
case Left(parsingFailure) => | ||
println("Failed to parse diff: " + parsingFailure.reason) | ||
//case Right(gitDiffs) => gitDiffs.foreach {println} | ||
case Right(gitDiffs) => println("Right!") | ||
case _ => println("Neither") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ch.mibex.bitbucket.sonar | ||
/* | ||
import ch.mibex.bitbucket.sonar.diff.GitDiffParser | ||
import ch.mibex.bitbucket.sonar.diff.GitDiffParser.{NewFileMode, NewMode, OldMode, fileMode, newFileMode, newMode, oldMode} | ||
import org.junit.runner.RunWith | ||
import org.specs2.runner.JUnitRunner | ||
import java.io.File | ||
import scala.io.Source | ||
import org.scalatest._ | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import flatspec._ | ||
import matchers._ | ||
@RunWith(classOf[JUnitRunner]) | ||
class TestParser extends AnyFlatSpec with should.Matchers { | ||
//private def readFile(path: String) = | ||
// scala.io.Source.fromInputStream(getClass.getResourceAsStream(path)).mkString.replaceAll("\u0085", "") | ||
"A binary file" should "parse diff example successfully" in { | ||
val fileToRead = new File("D:/tmp/diff1.txt") | ||
val fileContents = Source.fromFile(fileToRead, "UTF-8").mkString | ||
GitDiffParser.parse(fileContents) match { | ||
case Left(parsingFailure) => | ||
println("Failed to parse diff: " + parsingFailure.reason) | ||
//case Right(gitDiffs) => gitDiffs.foreach {println} | ||
case Right(gitDiffs) => println("Right!") | ||
case _ => println("Neither") | ||
} | ||
} | ||
}*/ |