Some additional fixes
This commit is contained in:
parent
efddfa8e91
commit
9f6d53f214
@ -7,7 +7,6 @@ import kotlinx.io.core.readBytes
|
|||||||
/**
|
/**
|
||||||
* A source of binary data
|
* A source of binary data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface Binary {
|
interface Binary {
|
||||||
/**
|
/**
|
||||||
* The size of binary in bytes
|
* The size of binary in bytes
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package hep.dataforge.io
|
package hep.dataforge.io
|
||||||
|
|
||||||
|
import hep.dataforge.meta.Meta
|
||||||
import hep.dataforge.meta.buildMeta
|
import hep.dataforge.meta.buildMeta
|
||||||
import hep.dataforge.meta.get
|
import hep.dataforge.meta.get
|
||||||
|
import hep.dataforge.meta.seal
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
@ -34,6 +36,8 @@ class MetaFormatTest {
|
|||||||
val string = meta.toString(JsonMetaFormat)
|
val string = meta.toString(JsonMetaFormat)
|
||||||
val result = JsonMetaFormat.parse(string)
|
val result = JsonMetaFormat.parse(string)
|
||||||
|
|
||||||
|
assertEquals<Meta>(meta, meta.seal())
|
||||||
|
|
||||||
meta.items.keys.forEach {
|
meta.items.keys.forEach {
|
||||||
if (meta[it] != result[it]) error("${meta[it]} != ${result[it]}")
|
if (meta[it] != result[it]) error("${meta[it]} != ${result[it]}")
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,10 @@ import hep.dataforge.values.boolean
|
|||||||
*/
|
*/
|
||||||
sealed class MetaItem<out M : Meta> {
|
sealed class MetaItem<out M : Meta> {
|
||||||
data class ValueItem(val value: Value) : MetaItem<Nothing>(){
|
data class ValueItem(val value: Value) : MetaItem<Nothing>(){
|
||||||
override fun toString(): String = value.string
|
override fun toString(): String = value.toString()
|
||||||
}
|
}
|
||||||
data class NodeItem<M : Meta>(val node: M) : MetaItem<M>(){
|
data class NodeItem<M : Meta>(val node: M) : MetaItem<M>(){
|
||||||
override fun toString(): String = node.toString()
|
override fun toString(): String = node.toString()
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
|
||||||
return this.node == (other as? NodeItem<*>).node
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class ListValue(override val list: List<Value>) : Value {
|
|||||||
override val number: Number get() = list.first().number
|
override val number: Number get() = list.first().number
|
||||||
override val string: String get() = list.first().string
|
override val string: String get() = list.first().string
|
||||||
|
|
||||||
override fun toString(): String = value.toString()
|
override fun toString(): String = list.joinToString (prefix = "[ ", postfix = " ]")
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
|
@ -27,8 +27,7 @@ class HtmlOutput<T : Any>(override val context: Context, private val consumer: T
|
|||||||
} else {
|
} else {
|
||||||
val value = cache[obj::class]
|
val value = cache[obj::class]
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
val answer = context.top<HtmlBuilder<*>>().values
|
val answer = context.top<HtmlBuilder<*>>(HTML_CONVERTER_TYPE).values.firstOrNull { it.type.isInstance(obj) }
|
||||||
.filter { it.type.isInstance(obj) }.firstOrNull()
|
|
||||||
if (answer != null) {
|
if (answer != null) {
|
||||||
cache[obj::class] = answer
|
cache[obj::class] = answer
|
||||||
answer
|
answer
|
@ -0,0 +1,4 @@
|
|||||||
|
package hep.dataforge.scripting
|
||||||
|
|
||||||
|
internal object Placeholder {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user