File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
main/kotlin/no/uio/microobject/main
test/kotlin/no/uio/microobject/test/basic Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ data class Settings(var verbose : Boolean, //Verbosity
50
50
return prefixMapCache as HashMap <String , String >
51
51
}
52
52
53
+ fun addPrefixes (prefixes : HashMap <String , String >){
54
+ prefixMapCache = null
55
+ extraPrefixes.putAll(prefixes)
56
+ }
57
+
53
58
fun replaceKnownPrefixes (string : String ) : String {
54
59
var res = string.replace(" domain:" , " $domainPrefix :" )
55
60
.replace(" prog:" , " $progPrefix :" )
Original file line number Diff line number Diff line change
1
+ package no.uio.microobject.test.basic
2
+
3
+ import io.kotest.matchers.shouldBe
4
+ import no.uio.microobject.test.MicroObjectTest
5
+
6
+ class ExtraPrefixTest : MicroObjectTest () {
7
+ fun prefixTest () {
8
+ val (interpreter,_) = initInterpreter(" persons" , StringLoad .RES )
9
+
10
+ interpreter.settings.prefixMap().containsKey(" ast" ) shouldBe false
11
+ interpreter.settings.addPrefixes(hashMapOf(" ast" to " http://www.smolang.org/ast#" ))
12
+ interpreter.settings.prefixMap().containsKey(" ast" ) shouldBe true
13
+ }
14
+ init {
15
+ prefixTest()
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments