(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestParseQueryParams(t *testing.T) { |
| 57 | for _, comments := range [][]string{ |
| 58 | { |
| 59 | " name: CreateFoo :one", |
| 60 | " @param foo_id UUID", |
| 61 | }, |
| 62 | { |
| 63 | " name: CreateFoo :one ", |
| 64 | " @param foo_id UUID ", |
| 65 | }, |
| 66 | { |
| 67 | " name: CreateFoo :one", |
| 68 | "@param foo_id UUID", |
| 69 | " invalid", |
| 70 | }, |
| 71 | { |
| 72 | " name: CreateFoo :one", |
| 73 | " @invalid", |
| 74 | " @param foo_id UUID", |
| 75 | }, |
| 76 | { |
| 77 | " name: GetFoos :many ", |
| 78 | " @param foo_id UUID ", |
| 79 | " @param @invalid UUID ", |
| 80 | }, |
| 81 | } { |
| 82 | params, _, _, err := ParseCommentFlags(comments) |
| 83 | if err != nil { |
| 84 | t.Errorf("expected comments to parse, got err: %s", err) |
| 85 | } |
| 86 | |
| 87 | pt, ok := params["foo_id"] |
| 88 | if !ok { |
| 89 | t.Errorf("expected param not found") |
| 90 | } |
| 91 | |
| 92 | if pt != "UUID" { |
| 93 | t.Error("unexpected param metadata:", pt) |
| 94 | } |
| 95 | |
| 96 | _, ok = params["invalid"] |
| 97 | if ok { |
| 98 | t.Errorf("unexpected param found") |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | func TestParseQueryFlags(t *testing.T) { |
| 104 | for _, comments := range [][]string{ |
nothing calls this directly
no test coverage detected