bastion 0.53.2
ci / personal-data (push) Successful in 5s
ci / test (push) Successful in 3m4s
ci / fuzz (push) Successful in 3m45s

This commit is contained in:
Privatae
2026-10-20 04:42:14 +00:00
commit e4c9b69b46
471 changed files with 159794 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package main
import "testing"
func TestParseUpdateTarget(t *testing.T) {
cases := []struct {
body string
want string
}{
{`{"token_id":43,"ok":true,"update":{"version":"0.9.3"}}`, "0.9.3"},
{`{"token_id":43,"ok":true}`, ""}, // no directive
{`{"update":null}`, ""}, // explicit null
{`{"update":{"version":""}}`, ""}, // empty version
{`not json`, ""}, // garbage
}
for _, c := range cases {
if got := parseUpdateTarget([]byte(c.body)); got != c.want {
t.Errorf("parseUpdateTarget(%q) = %q, want %q", c.body, got, c.want)
}
}
}