Problem
I want to have a single executable with multiple go_bandit suites. Some of them may contain before_each.
Expected result
Each suite installed by go_bandit runs in a "sandboxed" environment and no variables or before_each would leak between them.
### Current result
A before_each inside a go_bandit works like a global, surviving longer than the lambda, triggering UBs.
Code example
This zip contains an example CPP. It declares two go_bandit and one of them initialises a unique_ptr in a before_each. Running as-is crashes due to a UB after the before_each was called in the wrong go_bandit.
Changing the order of the go_bandits causes Bandit to complain about before_each without an it.
This setup simulates what would happen if each go_bandit was in its own CPP file.
Request
I think Bandit needs to be modified to do one of these three possible solutions:
- Support multiple
go_bandit with before_each. Maybe there's a way to treat go_bandit's lambda as a implicit describe?
- Explicitly deny a
before_each inside a go_bandit. This seems to be the norm, because there's no mention to before_each inside go_bandit in docs. if so, then code should fail and docs needs to be explicit about it.
Problem
I want to have a single executable with multiple
go_banditsuites. Some of them may containbefore_each.Expected result
Each suite installed by
go_banditruns in a "sandboxed" environment and no variables orbefore_eachwould leak between them.### Current result
A
before_eachinside ago_banditworks like a global, surviving longer than the lambda, triggering UBs.Code example
This zip contains an example CPP. It declares two
go_banditand one of them initialises aunique_ptrin abefore_each. Running as-is crashes due to a UB after thebefore_eachwas called in the wronggo_bandit.Changing the order of the
go_bandits causes Bandit to complain aboutbefore_eachwithout anit.This setup simulates what would happen if each
go_banditwas in its own CPP file.Request
I think Bandit needs to be modified to do one of these three possible solutions:
go_banditwithbefore_each. Maybe there's a way to treatgo_bandit's lambda as a implicitdescribe?before_eachinside ago_bandit. This seems to be the norm, because there's no mention tobefore_eachinsidego_banditin docs. if so, then code should fail and docs needs to be explicit about it.