Initial commit after restructure
This commit is contained in:
30
profiles/framework_test.go
Normal file
30
profiles/framework_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright Safing ICS Technologies GmbH. Use of this source code is governed by the AGPL license that can be found in the LICENSE file.
|
||||
|
||||
package profiles
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testGetNewPath(t *testing.T, f *Framework, command, cwd, expect string) {
|
||||
newPath, err := f.GetNewPath(command, cwd)
|
||||
if err != nil {
|
||||
t.Errorf("GetNewPath failed: %s", err)
|
||||
}
|
||||
if newPath != expect {
|
||||
t.Errorf("GetNewPath return unexpected result: got %s, expected %s", newPath, expect)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFramework(t *testing.T) {
|
||||
f1 := &Framework{
|
||||
Find: "([^ ]+)$",
|
||||
Build: "{CWD}/{1}",
|
||||
}
|
||||
testGetNewPath(t, f1, "/usr/bin/python bash", "/bin", "/bin/bash")
|
||||
f2 := &Framework{
|
||||
Find: "([^ ]+)$",
|
||||
Build: "{1}|{CWD}/{1}",
|
||||
}
|
||||
testGetNewPath(t, f2, "/usr/bin/python /bin/bash", "/tmp", "/bin/bash")
|
||||
}
|
||||
Reference in New Issue
Block a user