(assert string)
| 211 | } |
| 212 | |
| 213 | func (p *ParserAssert) Run(assert string) (bool, error) { |
| 214 | output, err := p.RunExpression(assert) |
| 215 | if err != nil { |
| 216 | return false, err |
| 217 | } |
| 218 | |
| 219 | switch out := output.(type) { |
| 220 | case bool: |
| 221 | return out, nil |
| 222 | default: |
| 223 | return false, fmt.Errorf("assertion '%s' is not a condition", assert) |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | func Escape(val string) string { |
| 228 | val = strings.ReplaceAll(val, `\`, `\\`) |
no test coverage detected