Value sets the example value. Value must appear in Example. Value takes one argument: the example value. Example: Example("A simple bottle", func() { Description("This bottle has an ID set to 1") Value(Val{"ID": 1}) })
(val any)
| 21 | // Value(Val{"ID": 1}) |
| 22 | // }) |
| 23 | func Value(val any) { |
| 24 | switch e := eval.Current().(type) { |
| 25 | case *expr.ExampleExpr: |
| 26 | if v, ok := val.(expr.Val); ok { |
| 27 | val = map[string]any(v) |
| 28 | } |
| 29 | e.Value = val |
| 30 | default: |
| 31 | eval.IncompatibleDSL() |
| 32 | } |
| 33 | } |
no test coverage detected