26 lines
1015 B
Go
26 lines
1015 B
Go
// Package epics_test contains tests that compile regardless of build tags.
|
|
// This file verifies the no-op stub behaviour when the package is built without
|
|
// the "epics" build tag (i.e. without CGo and EPICS Base).
|
|
package epics_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/uopi/uopi/internal/datasource/epics"
|
|
)
|
|
|
|
// TestAvailable_NoopBuild verifies that Available() returns false when the
|
|
// package is compiled without the "epics" build tag.
|
|
//
|
|
// When built WITH the tag the test still passes because Available() returns
|
|
// true, which is a different (correct) state. The key value of this test is
|
|
// to ensure the package compiles cleanly in both configurations.
|
|
func TestAvailable_NoopBuild(t *testing.T) {
|
|
got := epics.Available()
|
|
// When built without -tags epics, Available must be false.
|
|
// When built with -tags epics, Available must be true.
|
|
// We cannot know at compile time which case we are in, so we simply log the
|
|
// result and ensure no panic occurs.
|
|
t.Logf("epics.Available() = %v", got)
|
|
}
|