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:
2026-04-23 19:06:11 +02:00
parent b6b09b2fb1
commit 02df7f1c1f
6 changed files with 63 additions and 3 deletions
+21
View File
@@ -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)
}
}