Skip to content

Commit b7adbdc

Browse files
committed
Make all tests pass (ignoring dom reliant tests in the nodejs context)
1 parent 6322e20 commit b7adbdc

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

core/base/src/jsMain/kotlin/nl/adaptivity/xmlutil/core/impl/dom/DOMImplementationImpl.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* Copyright (c) 2024.
2+
* Copyright (c) 2024-2025.
33
*
44
* This file is part of xmlutil.
55
*
6-
* This file is licenced to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You should have received a copy of the license with the source distribution.
9-
* Alternatively, you may obtain a copy of the License at
6+
* This file is licenced to you under the Apache License, Version 2.0
7+
* (the "License"); you may not use this file except in compliance
8+
* with the License. You should have received a copy of the license
9+
* with the source distribution. Alternatively, you may obtain a copy
10+
* of the License at
1011
*
1112
* http://www.apache.org/licenses/LICENSE-2.0
1213
*
13-
* Unless required by applicable law or agreed to in writing,
14-
* software distributed under the License is distributed on an
15-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16-
* KIND, either express or implied. See the License for the
17-
* specific language governing permissions and limitations
18-
* under the License.
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17+
* implied. See the License for the specific language governing
18+
* permissions and limitations under the License.
1919
*/
2020

2121
package nl.adaptivity.xmlutil.core.impl.dom
@@ -31,10 +31,9 @@ import nl.adaptivity.xmlutil.dom.DocumentType as DocumentType1
3131

3232
internal object DOMImplementationImpl : IDOMImplementation {
3333
val delegate: DOMImplementation by lazy {
34-
when (document) {
35-
null -> DOMParser().parseFromString("<root></root>", "text/xml").implementation
36-
else -> document.implementation
37-
}
34+
runCatching { document.implementation }
35+
.recoverCatching { DOMParser().parseFromString("<root></root>", "text/xml").implementation }
36+
.getOrThrow()
3837
}
3938

4039
override val supportsWhitespaceAtToplevel: Boolean get() = true

serialization/src/commonTest/kotlin/nl/adaptivity/xml/serialization/regressions/EntityInNode291.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import nl.adaptivity.xmlutil.dom2.Text
3030
import nl.adaptivity.xmlutil.dom2.data
3131
import nl.adaptivity.xmlutil.serialization.XML
3232
import nl.adaptivity.xmlutil.serialization.XmlValue
33+
import nl.adaptivity.xmlutil.test.multiplatform.Target
34+
import nl.adaptivity.xmlutil.test.multiplatform.testTarget
3335
import nl.adaptivity.xmlutil.util.CompactFragment
3436
import nl.adaptivity.xmlutil.xmlStreaming
3537
import kotlin.test.Test
@@ -74,13 +76,17 @@ class EntityInNode291 {
7476

7577
@Test
7678
fun assertSerializeNodeTag() {
79+
if (testTarget == Target.Node) return
80+
7781
val document = xmlStreaming.genericDomImplementation.createDocument()
7882
val data = NodeTag(listOf(document.createTextNode("&Content")))
7983
assertXmlEquals(expectedXml, xml.encodeToString(data))
8084
}
8185

8286
@Test
8387
fun assertDeserializeNodeTag() {
88+
if (testTarget == Target.Node) return
89+
8490
val actual = xml.decodeFromString<NodeTag>(expectedXml)
8591
assertEquals(2, actual.content.size, "Unexpected content: ${actual.content.joinToString()}")
8692
val textNode1 = assertIs<Text>(actual.content[0])

xmlschema/src/jvmTest/kotlin/io/github/pdvrieze/formats/xmlschema/test/TestXSTestSuite.kt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* Copyright (c) 2023.
2+
* Copyright (c) 2023-2025.
33
*
44
* This file is part of xmlutil.
55
*
6-
* This file is licenced to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You should have received a copy of the license with the source distribution.
9-
* Alternatively, you may obtain a copy of the License at
6+
* This file is licenced to you under the Apache License, Version 2.0
7+
* (the "License"); you may not use this file except in compliance
8+
* with the License. You should have received a copy of the license
9+
* with the source distribution. Alternatively, you may obtain a copy
10+
* of the License at
1011
*
1112
* http://www.apache.org/licenses/LICENSE-2.0
1213
*
13-
* Unless required by applicable law or agreed to in writing,
14-
* software distributed under the License is distributed on an
15-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16-
* KIND, either express or implied. See the License for the
17-
* specific language governing permissions and limitations
18-
* under the License.
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17+
* implied. See the License for the specific language governing
18+
* permissions and limitations under the License.
1919
*/
2020

2121
package io.github.pdvrieze.formats.xmlschema.test
@@ -42,12 +42,14 @@ import org.w3.xml.xmschematestsuite.override.CompactOverride
4242
import org.w3.xml.xmschematestsuite.override.OTSSuite
4343
import java.net.URI
4444
import java.net.URL
45-
import kotlin.datetime.Instant
4645
import kotlin.experimental.ExperimentalTypeInference
4746
import kotlin.test.assertEquals
4847
import kotlin.test.assertFails
4948
import kotlin.test.assertTrue
49+
import kotlin.time.ExperimentalTime
50+
import kotlin.time.Instant
5051

52+
@OptIn(ExperimentalTime::class)
5153
class TestXSTestSuite {
5254

5355
var xml: XML = XML {

0 commit comments

Comments
 (0)