| 10 | ) |
| 11 | |
| 12 | func TestSetup(t *testing.T) { |
| 13 | tests := []struct { |
| 14 | input string |
| 15 | shouldErr bool |
| 16 | expectedErrContent string |
| 17 | expectedMaxStreams *int |
| 18 | }{ |
| 19 | // Valid configurations |
| 20 | { |
| 21 | input: `https3`, |
| 22 | shouldErr: false, |
| 23 | }, |
| 24 | { |
| 25 | input: `https3 { |
| 26 | }`, |
| 27 | shouldErr: false, |
| 28 | }, |
| 29 | { |
| 30 | input: `https3 { |
| 31 | max_streams 100 |
| 32 | }`, |
| 33 | shouldErr: false, |
| 34 | expectedMaxStreams: intPtr(100), |
| 35 | }, |
| 36 | // Zero values (unbounded) |
| 37 | { |
| 38 | input: `https3 { |
| 39 | max_streams 0 |
| 40 | }`, |
| 41 | shouldErr: false, |
| 42 | expectedMaxStreams: intPtr(0), |
| 43 | }, |
| 44 | // Error cases |
| 45 | { |
| 46 | input: `https3 { |
| 47 | max_streams |
| 48 | }`, |
| 49 | shouldErr: true, |
| 50 | expectedErrContent: "Wrong argument count", |
| 51 | }, |
| 52 | { |
| 53 | input: `https3 { |
| 54 | max_streams abc |
| 55 | }`, |
| 56 | shouldErr: true, |
| 57 | expectedErrContent: "invalid max_streams value", |
| 58 | }, |
| 59 | { |
| 60 | input: `https3 { |
| 61 | max_streams -1 |
| 62 | }`, |
| 63 | shouldErr: true, |
| 64 | expectedErrContent: "must be a non-negative integer", |
| 65 | }, |
| 66 | { |
| 67 | input: `https3 { |
| 68 | max_streams 100 |
| 69 | max_streams 200 |