mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Berry update tests for module undefined
This commit is contained in:
parent
553bc6706b
commit
74b11c8e3b
@ -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 -#
|
||||
|
Loading…
x
Reference in New Issue
Block a user