From 19ccdef512806adfa3dee737ffcc7de3e7478b3c Mon Sep 17 00:00:00 2001 From: Dibyendu Majumdar Date: Sat, 22 May 2021 14:25:42 +0100 Subject: [PATCH] #225 #172 fix type assertion inconsistencies --- tests/language/ravi_tests1.ravi | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/language/ravi_tests1.ravi b/tests/language/ravi_tests1.ravi index 629cf980..19e5e1d3 100644 --- a/tests/language/ravi_tests1.ravi +++ b/tests/language/ravi_tests1.ravi @@ -2050,6 +2050,43 @@ do end print 'Test 100 OK' +do + local function x(a, b) + local z : integer[] = { a, b } + return z + end + assert(pcall(x, 1, 2.0)) + assert(not pcall(x, 1.5, 2)) + assert(not pcall(x, '1.5', 2)) + assert(not pcall(x, false, 2)) + assert(not pcall(x, nil, 2)) + compile(x) + assert(pcall(x, 1, 2.0)) + assert(not pcall(x, 1.5, 2)) + assert(not pcall(x, '1.5', 2)) + assert(not pcall(x, false, 2)) + assert(not pcall(x, nil, 2)) +end +print 'Test 101 OK' + +do + local function x(a, b) + local z : number[] = { a, b } + return z + end + assert(pcall(x, 42, 2.2)) + assert(not pcall(x, '1.5', 2)) + assert(not pcall(x, false, 2)) + assert(not pcall(x, nil, 2)) + compile(x) + assert(pcall(x, 42, 2.2)) + assert(not pcall(x, '1.5', 2)) + assert(not pcall(x, false, 2)) + assert(not pcall(x, nil, 2)) +end +print 'Test 102 OK' + + for k,v in pairs(opcodes_coverage) do print(k, v)