-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove println statements from debugging * Reorganization testing for platform coverage * Add a MetaDataTest suite
- Loading branch information
reidspencer
committed
Feb 22, 2025
1 parent
597f1e8
commit ad91035
Showing
16 changed files
with
100 additions
and
60 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
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
37 changes: 37 additions & 0 deletions
37
language/shared/src/test/scala/com/ossuminc/riddl/language/parsing/MetaDataTest.scala
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,37 @@ | ||
/* | ||
* Copyright 2019-2025 Ossum, Inc. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ossuminc.riddl.language.parsing | ||
import com.ossuminc.riddl.language.AST.Context | ||
import com.ossuminc.riddl.utils.PlatformContext | ||
import org.scalatest.TestData | ||
|
||
abstract class MetaDataTest(using PlatformContext) extends AbstractParsingTest { | ||
|
||
"MetaDataParser" should { | ||
"parse attachments correctly" in { (td: TestData) => | ||
val input = RiddlParserInput( | ||
"""context foo { | ||
| ??? | ||
|} with { | ||
| attachment infile is text/plain in file "nada.txt" | ||
| attachment inline is text/plain as "nada" | ||
|}""".stripMargin, | ||
td | ||
) | ||
parseDefinition[Context](input) match { | ||
case Left(errors) => | ||
val msg = errors.map(_.format).mkString | ||
fail(msg) | ||
case Right((context: Context, _)) => | ||
context.stringAttachments.size must be(1) | ||
context.stringAttachments.head.value.s must be("nada") | ||
context.fileAttachments.size must be(1) | ||
context.fileAttachments.head.inFile.s must be("nada.txt") | ||
} | ||
} | ||
} | ||
} |
12 changes: 0 additions & 12 deletions
12
passes/js/src/test/scala/com/ossuminc/riddl/passes/JSTests.scala
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
passes/js/src/test/scala/com/ossuminc/riddl/passes/diagrams/JSDiagramsPassTest.scala
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,11 @@ | ||
/* | ||
* Copyright 2019-2025 Ossum, Inc. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ossuminc.riddl.passes.diagrams | ||
|
||
import com.ossuminc.riddl.utils.pc | ||
|
||
class JSDiagramsPassTest extends SharedDiagramsPassTest |
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions
12
passes/jvm-native/src/test/scala/com/ossuminc/riddl/passes/JVMTests.scala
This file was deleted.
Oops, something went wrong.
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
11 changes: 11 additions & 0 deletions
11
passes/jvm/src/test/scala/com/ossuminc/riddl/passes/diagrams/JVMDiagramsPassTest.scala
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,11 @@ | ||
/* | ||
* Copyright 2019-2025 Ossum, Inc. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ossuminc.riddl.passes.diagrams | ||
import com.ossuminc.riddl.utils.{ec, pc} | ||
|
||
class JVMDiagramsPassTest extends SharedDiagramsPassTest | ||
|
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
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
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 |
---|---|---|
|
@@ -36,7 +36,8 @@ abstract class SharedPathResolutionPassTest(using pc: PlatformContext) extends S | |
val pid: Type = domains.head.types.head | ||
val parent = domains.head | ||
val resolution = outputs.outputOf[ResolutionOutput](ResolutionPass.name).get | ||
resolution.refMap.definitionOf[Type](pid.typEx.asInstanceOf[AliasedTypeExpression].pathId, parent) match { | ||
resolution.refMap | ||
.definitionOf[Type](pid.typEx.asInstanceOf[AliasedTypeExpression].pathId, parent) match { | ||
case Some(definition) => | ||
definition must be(target) | ||
case None => | ||
|
@@ -307,7 +308,8 @@ abstract class SharedPathResolutionPassTest(using pc: PlatformContext) extends S | |
"resolve simple path through an include" in { _ => | ||
import com.ossuminc.riddl.utils.URL | ||
val eL = At.empty | ||
val root = Root(At(), | ||
val root = Root( | ||
At(), | ||
contents = Contents( | ||
Domain( | ||
eL, | ||
|
@@ -457,5 +459,29 @@ abstract class SharedPathResolutionPassTest(using pc: PlatformContext) extends S | |
fail("contained group not found") | ||
}() | ||
} | ||
"resolve author from authorref" in { (td: TestData) => | ||
val rpi = RiddlParserInput( | ||
"""domain foo { | ||
| author Reid is { name: "Reid Spencer", email: "[email protected]" } | ||
| context app { | ||
| ??? | ||
| } with { | ||
| by author foo.Reid | ||
| } | ||
|} | ||
|""".stripMargin, | ||
td | ||
) | ||
parseAndResolve(rpi) { (pi: PassInput, po: PassesOutput) => | ||
val app: Context = pi.root.contents.filter[Domain].head.contexts.head | ||
val au: AuthorRef = app.authorRefs.head | ||
po.refMap.definitionOf[Author](au.pathId) match | ||
case Some(author: Author) => | ||
author.id.value must be("Reid") | ||
author.name.s must be("Reid Spencer") | ||
case _ => | ||
fail("authorRef not resolved") | ||
} | ||
} | ||
} | ||
} |