Skip to content

Commit 49e59fe

Browse files
committed
[ADDED] App with test files
1 parent 5efc726 commit 49e59fe

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
dependencies {
1111
// Project "app" depends on project "utils". (Project paths are separated with ":", so ":utils" refers to the top-level "utils" project.)
1212
implementation(project(":utils"))
13+
implementation(project(":lib"))
1314
}
1415

1516
application {

app/src/main/kotlin/App.kt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
package org.json5.app
22

3-
import org.json5.utils.Printer
3+
import io.github.json5.kotlin.JSON5
44

5-
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
6-
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
75
fun main() {
8-
val name = "Kotlin"
9-
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
10-
// to see how IntelliJ IDEA suggests fixing it.
11-
val message = "Hello, " + name + "!"
12-
val printer = Printer(message)
13-
printer.printMessage()
6+
val json5files = listOf(
7+
"empty-json.json5",
8+
)
149

15-
for (i in 1..5) {
16-
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
17-
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
18-
println("i = $i")
10+
json5files.forEach { fileName ->
11+
println("Processing file: $fileName")
12+
// Load the file from resources using the classloader
13+
val resourceStream = object {}.javaClass.getResourceAsStream("/$fileName")
14+
15+
if (resourceStream != null) {
16+
val content = resourceStream.bufferedReader().use { it.readText() }
17+
JSON5.parse(content).also { parsed ->
18+
println("Parsed JSON5: $parsed")
19+
}
20+
} else {
21+
println("Error: Could not find resource: $fileName")
22+
}
1923
}
2024
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)