Setting up a structure for a sequence of tests?

EDIT: my issue was unrelated to the question - the problem wound up being improper spacing.

I have a package that I’d like to have some tests built in for. There is a structure that wraps some functionality in a C++ library, so I have overloaded getproperty for it, so it looks a bit un-Julian.

mutable struct Thing
    p::Ptr{Cvoid}
end

function Base.getproperty(this::Thing, s::Symbol)
    if s == :Foo
        function foo()
            # ... does stuff with pointer
        end
    else
        getfield(this, s)
    end
end

Anyhow, I want to start off my test with a setup call, and then run a sequence of tests, but this doesn’t work:

using Test

a = Thing()

@testset "Ensure Foo-ness" begin
    @test a.Foo()
    # ...
end
ERROR: LoadError: syntax: "begin" at /home/frylock/opt/Wrapper/test/runtests.jl:5 expected "end", got "a"

What is the right way to handle setup/teardown?

Can’t reproduce.

julia> using Test

julia> mutable struct Thing
           p::Ptr{Cvoid}
       end

julia> function Base.getproperty(this::Thing, s::Symbol)
           if s == :Foo
               function foo()
                   return true
               end
           else
               getfield(this, s)
           end
       end

julia> a = Thing(C_NULL)
Thing(Ptr{Nothing} @0x0000000000000000)

julia> @testset "Ensure Foo-ness" begin
           @test a.Foo()
       end;
Test Summary:   | Pass  Total  Time
Ensure Foo-ness |    1      1  0.0s

You are right sir:
The problem was that I had a test like this:

@test_logs(:warn, "my warning") the_expression

instead of

@test_logs (:warn, "my warning") the_expression

The space was important, embarassing :frowning: