Skip to content

"Soft scope" behaviour? #31

Open
Open
@ghyatzo

Description

@ghyatzo

the example in the README.md currently does not work.

module MyPackage

using TestItems

function foo(x)
    return x*x
end

@testitem "Test for foo" begin
    x = foo("bar")

    @test x == "barbar"
end

end

since we are not exporting foo or calling MyPackage.foo, we get an undefined variable error.
Is the example above a not yet implemented end goal or It is not really the intended behaviour anymore and we are supposed to either export all methods we want to test or just explicit the scope?
Why not invisibly prepend MyPackage. to all symbols defined in the package and called within the @testitem body, when the test is run? It would simulate the soft-scope behaviour in the example and keep the sandbox at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions