Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9.20 #699

Merged
merged 14 commits into from
Nov 13, 2023
Merged
Prev Previous commit
Next Next commit
Remove legacy tests
  • Loading branch information
ilgonmic authored and woainikk committed Oct 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a6c5d8fd0762c28a370c23818c0a2bc6f36c36f7
18 changes: 0 additions & 18 deletions src/test/kotlin/com/compiler/server/CommandLineArgumentsTest.kt
Original file line number Diff line number Diff line change
@@ -23,15 +23,6 @@ class CommandLineArgumentsTest : BaseExecutorTest() {
)
}

@Test
fun `command line arguments js test`() {
runJs(
code = "fun main(args: Array<String>) {\n println(args[0])\n println(args[1])\n}",
args = "0 1",
contains = "main(['0', '1']);"
)
}

@Test
fun `command line arguments js ir test`() {
runJsIr(
@@ -41,15 +32,6 @@ class CommandLineArgumentsTest : BaseExecutorTest() {
)
}

@Test
fun `command line string arguments js test`() {
runJs(
code = "fun main(args: Array<String>) {\n println(args[0])\n println(args[1])\n}",
args = "alex1 alex2",
contains = "main(['alex1', 'alex2']);"
)
}

@Test
fun `command line string arguments js ir test`() {
runJsIr(
30 changes: 0 additions & 30 deletions src/test/kotlin/com/compiler/server/ConvertToJsRunnerTest.kt
Original file line number Diff line number Diff line change
@@ -3,36 +3,6 @@ package com.compiler.server
import com.compiler.server.base.BaseExecutorTest
import org.junit.jupiter.api.Test

class ConvertToJsRunnerTest : BaseExecutorTest() {

@Test
fun `base execute test`() {
runJs(
code = "fun main() {\n println(\"Hello, world!!!\")\n}",
contains = "println('Hello, world!!!');"
)
}

@Test
fun `base execute test multi`() {
runJs(
code = listOf(
"import cat.Cat\n\nfun main(args: Array<String>) {\nval cat = Cat(\"Kitty\")\nprintln(cat.name)\n}",
"package cat\n class Cat(val name: String)"
),
contains = "var cat = new Cat('Kitty');"
)
}

@Test
fun `canvas with jquery test`() {
runJs(
code = "package fancylines\n\n\nimport org.w3c.dom.CanvasRenderingContext2D\nimport org.w3c.dom.HTMLCanvasElement\nimport kotlinx.browser.document\nimport kotlinx.browser.window\nimport kotlin.random.Random\n\n\n\nval canvas = initalizeCanvas()\nfun initalizeCanvas(): HTMLCanvasElement {\n val canvas = document.createElement(\"canvas\") as HTMLCanvasElement\n val context = canvas.getContext(\"2d\") as CanvasRenderingContext2D\n context.canvas.width = window.innerWidth.toInt();\n context.canvas.height = window.innerHeight.toInt();\n document.body!!.appendChild(canvas)\n return canvas\n}\n\nclass FancyLines() {\n val context = canvas.getContext(\"2d\") as CanvasRenderingContext2D\n val height = canvas.height\n val width = canvas.width\n var x = width * Random.nextDouble()\n var y = height * Random.nextDouble()\n var hue = 0;\n\n fun line() {\n context.save();\n\n context.beginPath();\n\n context.lineWidth = 20.0 * Random.nextDouble();\n context.moveTo(x, y);\n\n x = width * Random.nextDouble();\n y = height * Random.nextDouble();\n\n context.bezierCurveTo(width * Random.nextDouble(), height * Random.nextDouble(),\n width * Random.nextDouble(), height * Random.nextDouble(), x, y);\n\n hue += (Random.nextDouble() * 10).toInt();\n\n context.strokeStyle = \"hsl(\$hue, 50%, 50%)\";\n\n context.shadowColor = \"white\";\n context.shadowBlur = 10.0;\n\n context.stroke();\n\n context.restore();\n }\n\n fun blank() {\n context.fillStyle = \"rgba(255,255,1,0.1)\";\n context.fillRect(0.0, 0.0, width.toDouble(), height.toDouble());\n }\n\n fun run() {\n window.setInterval({ line() }, 40);\n window.setInterval({ blank() }, 100);\n }\n}\nfun main(args: Array<String>) {\n FancyLines().run()\n}",
contains = "this.context = Kotlin.isType(tmp\$ = canvas.getContext('2d'), CanvasRenderingContext2D) ? tmp\$ : throwCCE();",
)
}
}

class ConvertToJsIrRunnerTest : BaseExecutorTest() {
@Test
fun `base execute test`() {