mirror of
https://github.com/bettercap/bettercap
synced 2025-07-30 19:50:06 -07:00
more unit tests
This commit is contained in:
parent
5a60e8897e
commit
735d074cd8
3 changed files with 73 additions and 15 deletions
|
@ -15,20 +15,16 @@ type SetCallback func(newValue string)
|
|||
|
||||
type Environment struct {
|
||||
sync.Mutex
|
||||
|
||||
Padding int `json:"-"`
|
||||
Data map[string]string `json:"data"`
|
||||
|
||||
Data map[string]string `json:"data"`
|
||||
cbs map[string]SetCallback
|
||||
sess *Session
|
||||
}
|
||||
|
||||
func NewEnvironment(s *Session, envFile string) *Environment {
|
||||
env := &Environment{
|
||||
Padding: 0,
|
||||
Data: make(map[string]string),
|
||||
sess: s,
|
||||
cbs: make(map[string]SetCallback),
|
||||
Data: make(map[string]string),
|
||||
sess: s,
|
||||
cbs: make(map[string]SetCallback),
|
||||
}
|
||||
|
||||
if envFile != "" {
|
||||
|
@ -101,11 +97,6 @@ func (env *Environment) Set(name, value string) string {
|
|||
|
||||
env.sess.Events.Log(core.DEBUG, "env.change: %s -> '%s'", name, value)
|
||||
|
||||
width := len(name)
|
||||
if width > env.Padding {
|
||||
env.Padding = width
|
||||
}
|
||||
|
||||
return old
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue