mirror of
https://github.com/ollama/ollama.git
synced 2026-07-23 09:10:53 -05:00
22 lines
630 B
Go
22 lines
630 B
Go
//go:build windows || darwin
|
|
|
|
package tools
|
|
|
|
import "testing"
|
|
|
|
func TestDirectURLsFromText_RejectsChangedToolArgument(t *testing.T) {
|
|
ctx := WithAllowedDirectURLs(t.Context(), "summarize https://attacker.example/x")
|
|
|
|
if allowedDirectURL(ctx, "https://attacker.example/x!!!!") {
|
|
t.Fatal("expected changed tool argument to be rejected")
|
|
}
|
|
}
|
|
|
|
func TestDirectURLsFromText_ExtractsMarkdownCodeSpanURL(t *testing.T) {
|
|
ctx := WithAllowedDirectURLs(t.Context(), "summarize `https://example.com/privacy`")
|
|
|
|
if !allowedDirectURL(ctx, "https://example.com/privacy") {
|
|
t.Fatal("expected URL wrapped in backticks to be allowed")
|
|
}
|
|
}
|