| 1 | package spdxexp |
| 2 | |
| 3 | // getLicenseNode is a test helper method that is expected to create a valid |
| 4 | // license node. Use this function when the test data is known to be a valid |
| 5 | // license that would parse successfully. |
| 6 | func getLicenseNode(license string, hasPlus bool) *node { |
| 7 | return &node{ |
| 8 | role: licenseNode, |
| 9 | exp: nil, |
| 10 | lic: &licenseNodePartial{ |
| 11 | license: license, |
| 12 | hasPlus: hasPlus, |
| 13 | hasException: false, |
| 14 | exception: "", |
| 15 | }, |
| 16 | ref: nil, |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // getParsedNode is a test helper method that is expected to create a valid node |
| 21 | // and swallow errors. This allows test structures to use parsed node data. |
| 22 | // Use this function when the test data is expected to parse successfully. |
| 23 | func getParsedNode(expression string) *node { |
| 24 | // swallows errors |
| 25 | n, _ := parse(expression) |
| 26 | return n |
| 27 | } |