MCPcopy
hub / github.com/apache/casbin / TestModel_AddDef

Function TestModel_AddDef

model/model_test.go:114–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func TestModel_AddDef(t *testing.T) {
115 m := NewModel()
116 s := "r"
117 v := "sub, obj, act"
118 ok := m.AddDef(s, s, v)
119 if !ok {
120 t.Errorf("non empty assertion should be added")
121 }
122 ok = m.AddDef(s, s, "")
123 if ok {
124 t.Errorf("empty assertion value should not be added")
125 }
126}
127
128func TestModelToTest(t *testing.T) {
129 testModelToText(t, "r.sub == p.sub && r.obj == p.obj && r_func(r.act, p.act) && testr_func(r.act, p.act)", "r_sub == p_sub && r_obj == p_obj && r_func(r_act, p_act) && testr_func(r_act, p_act)")

Callers

nothing calls this directly

Calls 2

AddDefMethod · 0.95
NewModelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…