setup test

This commit is contained in:
asoseil 2017-11-22 17:23:41 +01:00
parent c2a3fae50d
commit fef9032fe4
2 changed files with 23 additions and 2 deletions

View File

@ -47,7 +47,6 @@ type Project struct {
init bool
files int64
folders int64
name string
lastFile string
paths []string
lastTime time.Time
@ -96,7 +95,7 @@ type ProjectI interface {
// Setup a project
func (p *Project) Setup() {
// get base path
p.name = filepath.Base(p.Path)
p.Name = filepath.Base(p.Path)
// set env const
for key, item := range p.Environment {
if err := os.Setenv(key, item); err != nil {

View File

@ -1 +1,23 @@
package realize
import (
"testing"
"os"
)
func TestProject_Setup(t *testing.T) {
input := "Rtest"
p := Project{
Path: "/test/prova/"+input,
Environment: map[string]string{
input: input,
},
}
p.Setup()
if p.Name != input{
t.Error("Unexpected error", p.Name,"instead",input)
}
if os.Getenv(input) != input{
t.Error("Unexpected error", os.Getenv(input),"instead",input)
}
}