Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions scanner/scanner_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package scanner

import (
"os"
"testing"
)

func TestDefaultBinaryPath(t *testing.T) {
var s = Scanner{
Name: "randomNameNoBinary",
}
got := s.GetDefaultBinaryPath()
var expected = "randomNameNoBinary"
if got != expected {
t.Errorf("GetDefaultBinaryPath = %s; want %s", got, expected)
}
expected = "otherBinary"
s.DefaultBinary = expected
got = s.GetDefaultBinaryPath()
if got != expected {
t.Errorf("GetDefaultBinaryPath = %s; want %s", got, expected)
}
}

func TestBuildOptions(t *testing.T) {
oldArgs := os.Args
defer func() { os.Args = oldArgs }()
os.Args = []string{"myscanner", "-H"}
got := s.BuildOptions()
ParseOptions(got)
}