Skip to content

Commit

Permalink
[unity]只写属性的测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Oct 25, 2024
1 parent 90ee775 commit 5bfa075
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions unity/test/Src/Cases/CrossLang/CrossLangTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ public TestObject(int val)
{
value = val;
}

static int tmp;

public int WriteOnly
{
set {
tmp = value;
}
}

public static int StaticWriteOnly
{
set {
tmp = value;
}
}
}
public struct TestStruct
{
Expand Down Expand Up @@ -584,6 +600,21 @@ public void JSFunctionInstanceTest()
");
jsEnv.Tick();
}

[Test]
public void WriteOnlyTest()
{
var jsEnv = UnitTestEnv.GetEnv();
jsEnv.Eval(@"
(function() {
let o = new CS.Puerts.UnitTest.TestObject(1);
let v = o.WriteOnly;
let sv = CS.Puerts.UnitTest.TestObject.StaticWriteOnly
})()
");
jsEnv.Tick();
}

[Test]
public void NoNewOnStaticFunction()
{
Expand Down

0 comments on commit 5bfa075

Please sign in to comment.