mirror of
https://github.com/enso-org/enso.git
synced 2024-11-27 04:52:45 +03:00
Test case with a function read from a variable (#6986)
Test checking that if the function is read from variable, it does not have the method pointer associated with it.
This commit is contained in:
parent
1ce3505e5b
commit
b2c1f97437
@ -1049,6 +1049,104 @@ class RuntimeServerTest
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it should "send method pointer updates of partially applied static methods without application" in {
|
||||||
|
pending
|
||||||
|
val contextId = UUID.randomUUID()
|
||||||
|
val requestId = UUID.randomUUID()
|
||||||
|
val moduleName = "Enso_Test.Test.Main"
|
||||||
|
|
||||||
|
val metadata = new Metadata
|
||||||
|
val id_x1_1 = metadata.addItem(18, 7, "aa")
|
||||||
|
val id_x1_2 = metadata.addItem(37, 4, "ab")
|
||||||
|
val id_x1 = metadata.addItem(51, 8, "ac")
|
||||||
|
|
||||||
|
val code =
|
||||||
|
"""main =
|
||||||
|
| x1_1 = T.func1
|
||||||
|
| x1_2 = x1_1
|
||||||
|
| x1 = x1_2 1 2
|
||||||
|
| x1
|
||||||
|
|
|
||||||
|
|type T
|
||||||
|
| A
|
||||||
|
|
|
||||||
|
| func1 x y = x + y
|
||||||
|
|""".stripMargin.linesIterator.mkString("\n")
|
||||||
|
val contents = metadata.appendToCode(code)
|
||||||
|
val mainFile = context.writeMain(contents)
|
||||||
|
|
||||||
|
// create context
|
||||||
|
context.send(Api.Request(requestId, Api.CreateContextRequest(contextId)))
|
||||||
|
context.receive shouldEqual Some(
|
||||||
|
Api.Response(requestId, Api.CreateContextResponse(contextId))
|
||||||
|
)
|
||||||
|
|
||||||
|
// open file
|
||||||
|
context.send(
|
||||||
|
Api.Request(Api.OpenFileNotification(mainFile, contents))
|
||||||
|
)
|
||||||
|
context.receiveNone shouldEqual None
|
||||||
|
|
||||||
|
// push main
|
||||||
|
context.send(
|
||||||
|
Api.Request(
|
||||||
|
requestId,
|
||||||
|
Api.PushContextRequest(
|
||||||
|
contextId,
|
||||||
|
Api.StackItem.ExplicitCall(
|
||||||
|
Api.MethodPointer(moduleName, moduleName, "main"),
|
||||||
|
None,
|
||||||
|
Vector()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
context.receiveN(6) should contain theSameElementsAs Seq(
|
||||||
|
Api.Response(Api.BackgroundJobsStartedNotification()),
|
||||||
|
Api.Response(requestId, Api.PushContextResponse(contextId)),
|
||||||
|
TestMessages.update(
|
||||||
|
contextId,
|
||||||
|
id_x1_1,
|
||||||
|
ConstantsGen.FUNCTION_BUILTIN,
|
||||||
|
Api.MethodCall(
|
||||||
|
Api.MethodPointer(
|
||||||
|
"Enso_Test.Test.Main",
|
||||||
|
"Enso_Test.Test.Main.T",
|
||||||
|
"func1"
|
||||||
|
),
|
||||||
|
Vector(0, 1)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
TestMessages.update(
|
||||||
|
contextId,
|
||||||
|
id_x1_2,
|
||||||
|
ConstantsGen.FUNCTION_BUILTIN,
|
||||||
|
// the method call is missing
|
||||||
|
Api.MethodCall(
|
||||||
|
Api.MethodPointer(
|
||||||
|
"Enso_Test.Test.Main",
|
||||||
|
"Enso_Test.Test.Main.T",
|
||||||
|
"func1"
|
||||||
|
),
|
||||||
|
Vector(1, 2)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
TestMessages.update(
|
||||||
|
contextId,
|
||||||
|
id_x1,
|
||||||
|
ConstantsGen.INTEGER_BUILTIN,
|
||||||
|
Api.MethodCall(
|
||||||
|
Api.MethodPointer(
|
||||||
|
"Enso_Test.Test.Main",
|
||||||
|
"Enso_Test.Test.Main.T",
|
||||||
|
"func1"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
context.executionComplete(contextId)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
it should "send method pointer updates of partially applied static methods defined as extensions on type" in {
|
it should "send method pointer updates of partially applied static methods defined as extensions on type" in {
|
||||||
val contextId = UUID.randomUUID()
|
val contextId = UUID.randomUUID()
|
||||||
val requestId = UUID.randomUUID()
|
val requestId = UUID.randomUUID()
|
||||||
|
Loading…
Reference in New Issue
Block a user