Skip to content

Commit 24f4eba

Browse files
committed
EvilBeaver#1673: Тесты на превышение количества параметров.
1 parent 391fe93 commit 24f4eba

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/Tests/OneScript.Core.Tests/NativeCompilerTest.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,6 @@ public void Can_Call_Member_ProceduresWithBslProcess(string code)
889889
var method = block.CreateDelegate<Func<TestContextClass, BslValue>>();
890890
var testValue = new TestContextClass();
891891
method(testValue);
892-
893892
}
894893

895894
[Theory]
@@ -913,7 +912,26 @@ public void Can_Call_Member_FunctionsWithBslProcess(string code)
913912
var method = block.CreateDelegate<Func<TestContextClass, BslValue>>();
914913
var testValue = new TestContextClass();
915914
method(testValue);
915+
}
916+
917+
[Theory]
918+
[InlineData("Объект.Процедура0СПроцессом(1)")]
919+
[InlineData("Объект.Функция0СПроцессом(1)")]
920+
[InlineData("Объект.Функция1СУмолчаниемСПроцессом(1, 2)")]
921+
[InlineData("Объект.Процедура1СУмолчаниемСПроцессом(1, 2, 3);")]
922+
public void Cannot_Call_Member_Procedures_With_Wrong_Argument_Count(string code)
923+
{
924+
var tm = new DefaultTypeManager();
925+
var testType = tm.RegisterClass(typeof(TestContextClass));
926+
927+
var block = new CompiledBlock(default);
928+
block.Parameters.Insert("Объект", new BslTypeValue(testType));
929+
block.CodeBlock = code;
916930

931+
var runtimeException = Assert.ThrowsAny<RuntimeException>(() => {
932+
var method = block.CreateDelegate<Func<TestContextClass, BslValue>>();
933+
});
934+
Assert.Contains("Слишком много фактических параметров", runtimeException.Message);
917935
}
918936

919937
[Fact]

0 commit comments

Comments
 (0)