more unit tests

This commit is contained in:
evilsocket 2018-04-26 15:16:49 +02:00
parent 5a60e8897e
commit 735d074cd8
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
3 changed files with 73 additions and 15 deletions

View file

@ -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
}