MCPcopy Create free account
hub / github.com/golang/appengine / TestNamespaceValidity

Function TestNamespaceValidity

namespace_test.go:12–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestNamespaceValidity(t *testing.T) {
13 testCases := []struct {
14 namespace string
15 ok bool
16 }{
17 // data from Python's namespace_manager_test.py
18 {"", true},
19 {"__a.namespace.123__", true},
20 {"-_A....NAMESPACE-_", true},
21 {"-", true},
22 {".", true},
23 {".-", true},
24
25 {"?", false},
26 {"+", false},
27 {"!", false},
28 {" ", false},
29 }
30 for _, tc := range testCases {
31 _, err := Namespace(context.Background(), tc.namespace)
32 if err == nil && !tc.ok {
33 t.Errorf("Namespace %q should be rejected, but wasn't", tc.namespace)
34 } else if err != nil && tc.ok {
35 t.Errorf("Namespace %q should be accepted, but wasn't", tc.namespace)
36 }
37 }
38}

Callers

nothing calls this directly

Calls 1

NamespaceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…