Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Soft scope" behaviour? #31

Open
ghyatzo opened this issue Oct 26, 2022 · 0 comments
Open

"Soft scope" behaviour? #31

ghyatzo opened this issue Oct 26, 2022 · 0 comments

Comments

@ghyatzo
Copy link

ghyatzo commented Oct 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant