Skip to content

Commit

Permalink
Merge pull request #2 from amitmiran137/patch-1
Browse files Browse the repository at this point in the history
Upgrade to new dialect in scala.meta
  • Loading branch information
kaplan-shaked authored Aug 7, 2024
2 parents a295730 + 64ae095 commit f6c134b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ jobs:
exit 0
fi
run-scala-cli-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: VirtusLab/scala-cli-setup@main
- name: Run tests
run: scala-cli test .
5 changes: 3 additions & 2 deletions resources/test.scala_test
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@


import java.io.Serializable
import scala.io.Source as src

@Serializable
case class TestClass1(field1: String, field2: Int){

src.DefaultBufSize.toString
}

@SomeAnnotation
Expand All @@ -21,4 +22,4 @@ case class TestClass4(field7: String, field8: Int)
@deriving(SomeAnnotation, SomeOtherAnnotation, Reader, Writer)
case class TestClass5(field9: Double, field10: Boolean = true){

}
}
4 changes: 3 additions & 1 deletion src/FileParser.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import scala.meta._

case class ScalaFile(
imports: List[String],
classes: List[ClassInfo],
Expand Down Expand Up @@ -45,7 +46,8 @@ object FileParser {

def parse(content: String): ScalaFile = {
val input = Input.String(content)
val exampleTree: Source = input.parse[Source].get
val dialect = dialects.Scala213Source3
val exampleTree: Source = dialect(input).parse[Source].get

val tree =
parseTreeClasses(exampleTree)
Expand Down
6 changes: 3 additions & 3 deletions test/BreakingChangeDetector.test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class BreakingChangeDetectorTest extends munit.FunSuite {
val oldFile = Thread
.currentThread()
.getContextClassLoader
.getResource("V1.scala_test")
.getResource("v1.scala_test")
.getPath
val oldFileParsed = FileParser.fromPathToClassDef(oldFile)
val newFile = Thread
Expand All @@ -23,7 +23,7 @@ class BreakingChangeDetectorTest extends munit.FunSuite {
val oldFile = Thread
.currentThread()
.getContextClassLoader
.getResource("V1.scala_test")
.getResource("v1.scala_test")
.getPath
val oldFileParsed = FileParser.fromPathToClassDef(oldFile)
val newFile = Thread
Expand Down Expand Up @@ -84,7 +84,7 @@ class BreakingChangeDetectorTest extends munit.FunSuite {
val oldFile = Thread
.currentThread()
.getContextClassLoader
.getResource("V1.scala_test")
.getResource("v1.scala_test")
.getPath
val oldFileParsed = FileParser.fromPathToClassDef(oldFile)
val newFile = Thread
Expand Down

0 comments on commit f6c134b

Please sign in to comment.