36 lines
550 B
Go
36 lines
550 B
Go
|
package detector
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestCheck(t *testing.T) {
|
||
|
flags, err := Check([]string{
|
||
|
"sleep",
|
||
|
"apache2",
|
||
|
"miner",
|
||
|
"verus-solve",
|
||
|
})
|
||
|
assert.Nil(t, err)
|
||
|
assert.Contains(t, flags, "miner")
|
||
|
|
||
|
flags, err = Check([]string{
|
||
|
"sleep",
|
||
|
"apache2",
|
||
|
"hellminer",
|
||
|
})
|
||
|
assert.Nil(t, err)
|
||
|
assert.Contains(t, flags, "miner")
|
||
|
|
||
|
flags, err = Check([]string{
|
||
|
"sleep",
|
||
|
"apache2",
|
||
|
"miner", // This is not among patterns map
|
||
|
})
|
||
|
assert.Nil(t, err)
|
||
|
assert.NotContains(t, flags, "miner")
|
||
|
|
||
|
}
|