github.com/lab47/exprcore@v0.0.0-20210525052339-fb7d6bd9331e/exprcore/testdata/module.star (about) 1 # Tests of Module. 2 3 load("assert.star", "assert") 4 5 assert.eq(type(assert), "module") 6 assert.eq(str(assert), '<module "assert">') 7 assert.eq(dir(assert), ["contains", "eq", "fail", "fails", "lt", "ne", "true"]) 8 assert.fails(=> (%{assert: None}), "unhashable: module") 9 10 def assignfield() { 11 assert.foo = None 12 } 13 assert.fails(assignfield, "can't assign to .foo field of module") 14 15 # no such field 16 assert.fails(=> assert.nonesuch, "module has no .nonesuch field or method$") 17 assert.fails(=> assert.falls, "module has no .falls field or method .did you mean .fails\\?")