setup test
This commit is contained in:
parent
c2a3fae50d
commit
fef9032fe4
@ -47,7 +47,6 @@ type Project struct {
|
|||||||
init bool
|
init bool
|
||||||
files int64
|
files int64
|
||||||
folders int64
|
folders int64
|
||||||
name string
|
|
||||||
lastFile string
|
lastFile string
|
||||||
paths []string
|
paths []string
|
||||||
lastTime time.Time
|
lastTime time.Time
|
||||||
@ -96,7 +95,7 @@ type ProjectI interface {
|
|||||||
// Setup a project
|
// Setup a project
|
||||||
func (p *Project) Setup() {
|
func (p *Project) Setup() {
|
||||||
// get base path
|
// get base path
|
||||||
p.name = filepath.Base(p.Path)
|
p.Name = filepath.Base(p.Path)
|
||||||
// set env const
|
// set env const
|
||||||
for key, item := range p.Environment {
|
for key, item := range p.Environment {
|
||||||
if err := os.Setenv(key, item); err != nil {
|
if err := os.Setenv(key, item); err != nil {
|
||||||
|
@ -1 +1,23 @@
|
|||||||
package realize
|
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