diff --git a/lib/libesp32/berry/tests/virtual_methods.be b/lib/libesp32/berry/tests/virtual_methods.be index 514fb3cc2..e744dcca8 100644 --- a/lib/libesp32/berry/tests/virtual_methods.be +++ b/lib/libesp32/berry/tests/virtual_methods.be @@ -32,9 +32,11 @@ assert_attribute_error(/-> t.c) class T2 : T1 def member(n) + import undefined if (n == 'f1') return / n -> n end if (n == 'f2') return /-> 4 end if (n == 'a1') return 10 end + if (n == 'h') return undefined end end end t2 = T2() @@ -50,6 +52,7 @@ assert_attribute_error(/-> t2.h()) assert(t2.f1() == t2) assert(t2.f2() == 4) assert(t2.a1 == 10) +assert(t2.foo == nil) #- module -# m = module("m") @@ -59,8 +62,11 @@ assert(m.a == 1) assert_attribute_error(/-> m.b) m.member = def(n) + import undefined if n == "b" return 2 end + if n == "c" return undefined end end assert(m.b == 2) assert_attribute_error(/-> m.c) +assert(m.d == nil) #- returns nil if no response -#