setup test
This commit is contained in:
parent
c2a3fae50d
commit
fef9032fe4
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user