Download this file
| 1 | package webread |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "testing" |
| 6 | |
| 7 | "amadan.net/rastrillo/rastrillo/budget" |
| 8 | ) |
| 9 | |
| 10 | // The test binary doubles as the fetcher, so the launch test can run it |
| 11 | // under bubblewrap: argv "webread <outdir>" is Main, "webread-probe |
| 12 | // <outdir>" reports what the process can see. |
| 13 | func TestMain(m *testing.M) { |
| 14 | if len(os.Args) > 1 { |
| 15 | switch os.Args[1] { |
| 16 | case "webread": |
| 17 | os.Exit(Main(os.Args[2:], os.Stdin, os.Stderr)) |
| 18 | case "webread-probe": |
| 19 | os.Exit(probeMain(os.Args[2:])) |
| 20 | case "webread-limits": |
| 21 | os.Exit(limitsMain(false)) |
| 22 | case "webread-limits-over": |
| 23 | os.Exit(limitsMain(true)) |
| 24 | case "webread-nochild": |
| 25 | os.Exit(noChildMain(os.Args[2:])) |
| 26 | } |
| 27 | } |
| 28 | os.Exit(budget.Main(m)) |
| 29 | } |
| 30 | |