(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func TestNewDoc(t *testing.T) { |
| 92 | tests := []struct { |
| 93 | newDoc func() *Doc |
| 94 | kind DocKind |
| 95 | name string |
| 96 | celType string |
| 97 | sig string |
| 98 | desc string |
| 99 | childCount int |
| 100 | }{ |
| 101 | { |
| 102 | newDoc: func() *Doc { |
| 103 | return NewMacroDoc("map", "map converts a list or map of values to a list", |
| 104 | NewExampleDoc("[1, 2].map(i, i * 2) // [2, 4]")) |
| 105 | }, |
| 106 | kind: DocMacro, |
| 107 | name: "map", |
| 108 | desc: "map converts a list or map of values to a list", |
| 109 | childCount: 1, |
| 110 | }, |
| 111 | { |
| 112 | newDoc: func() *Doc { |
| 113 | return NewVariableDoc( |
| 114 | "request", |
| 115 | "google.rpc.context.AttributeContext.Request", |
| 116 | "parameters related to an HTTP API request") |
| 117 | }, |
| 118 | kind: DocVariable, |
| 119 | name: "request", |
| 120 | celType: "google.rpc.context.AttributeContext.Request", |
| 121 | desc: "parameters related to an HTTP API request", |
| 122 | childCount: 0, |
| 123 | }, |
| 124 | { |
| 125 | newDoc: func() *Doc { |
| 126 | return NewFunctionDoc("getToken", |
| 127 | "get the JWT token from a request\nas deserialized JSON", |
| 128 | NewOverloadDoc("request_getToken", "request.getToken() -> map(string, dyn)", |
| 129 | NewExampleDoc("has(request.getToken().sub) // false"))) |
| 130 | }, |
| 131 | kind: DocFunction, |
| 132 | name: "getToken", |
| 133 | desc: "get the JWT token from a request\nas deserialized JSON", |
| 134 | childCount: 1, |
| 135 | }, |
| 136 | { |
| 137 | newDoc: func() *Doc { |
| 138 | return NewFieldDoc("google.rpc.context.AttributeContext.Request.token", "string", |
| 139 | "The HTTP URL scheme, such as `http` and `https`.", |
| 140 | NewExampleDoc("\"https\"")) |
| 141 | }, |
| 142 | kind: DocField, |
| 143 | name: "google.rpc.context.AttributeContext.Request.token", |
| 144 | celType: "string", |
| 145 | desc: "The HTTP URL scheme, such as `http` and `https`.", |
| 146 | childCount: 1, |
| 147 | }, |
| 148 | } |
nothing calls this directly
no test coverage detected