Plugin file name extension adapted to the host OS convention (.so on linux, .dll on windows, .dylib on Darwin/MacOS)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package expr
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -36,3 +37,23 @@ func TestMakePluginName(t *testing.T) {
|
||||
t.Errorf("makePluginName(%q) failed: Got: %q, Want: %q", name, got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadPluginName(t *testing.T) {
|
||||
name := "json"
|
||||
// want := "expr-" + name + "-plugin.so"
|
||||
want := 1
|
||||
|
||||
os.Setenv("PLUGINS", "${HOME}/go/src/git.portale-stac.it/go")
|
||||
// os.Setenv("EXPR_PLUGIN_PATH", "${PLUGINS}/expr-json-plugin:${PLUGINS}/expr-csv-plugin")
|
||||
os.Setenv("EXPR_PLUGIN_PATH", "${PLUGINS}")
|
||||
got, err := importPluginFromSearchPath(name)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("importPluginFromSearchPath(%q) failed: %v", name, err)
|
||||
return
|
||||
}
|
||||
|
||||
if got != want {
|
||||
t.Errorf("importPluginFromSearchPath(%q) failed: Got: %q, Want: %q", name, got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user