|
12 | 12 | derivatives: {'3' => '3'},
|
13 | 13 | timeout: true,
|
14 | 14 | duration_ns: 400,
|
15 |
| - duration_ext_ns: 500 |
| 15 | + duration_ext_ns: 500, |
| 16 | + input_truncated: false |
16 | 17 | )
|
17 | 18 | end
|
18 | 19 |
|
|
22 | 23 | it { expect(result.derivatives).to eq({'3' => '3'}) }
|
23 | 24 | it { expect(result.duration_ns).to eq(400) }
|
24 | 25 | it { expect(result.duration_ext_ns).to eq(500) }
|
| 26 | + it { expect(result.input_truncated?).to eq(false) } |
25 | 27 | end
|
26 | 28 |
|
27 | 29 | context 'when initializing error result' do
|
28 |
| - subject(:result) { described_class::Error.new(duration_ext_ns: 100) } |
| 30 | + subject(:result) { described_class::Error.new(duration_ext_ns: 100, input_truncated: false) } |
29 | 31 |
|
30 | 32 | it { expect(result).not_to be_timeout }
|
31 | 33 | it { expect(result.events).to eq([]) }
|
32 | 34 | it { expect(result.actions).to eq({}) }
|
33 | 35 | it { expect(result.derivatives).to eq({}) }
|
34 | 36 | it { expect(result.duration_ns).to eq(0) }
|
35 | 37 | it { expect(result.duration_ext_ns).to eq(100) }
|
| 38 | + it { expect(result.input_truncated?).to eq(false) } |
36 | 39 | end
|
37 | 40 | end
|
38 | 41 |
|
39 | 42 | describe '#timeout?' do
|
40 | 43 | context 'when result indicates timeout' do
|
41 | 44 | subject(:result) do
|
42 | 45 | described_class::Ok.new(
|
43 |
| - events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 0, duration_ext_ns: 0 |
| 46 | + events: [], actions: {}, derivatives: {}, timeout: true, duration_ns: 0, duration_ext_ns: 0, |
| 47 | + input_truncated: false |
44 | 48 | )
|
45 | 49 | end
|
46 | 50 |
|
|
50 | 54 | context 'when result does not indicate timeout' do
|
51 | 55 | subject(:result) do
|
52 | 56 | described_class::Ok.new(
|
53 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 57 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 58 | + input_truncated: false |
54 | 59 | )
|
55 | 60 | end
|
56 | 61 |
|
|
62 | 67 | context 'when result is a generic type' do
|
63 | 68 | subject(:result) do
|
64 | 69 | described_class::Base.new(
|
65 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 70 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 71 | + input_truncated: false |
66 | 72 | )
|
67 | 73 | end
|
68 | 74 |
|
|
72 | 78 | context 'when result is a "match" type' do
|
73 | 79 | subject(:result) do
|
74 | 80 | described_class::Match.new(
|
75 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 81 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 82 | + input_truncated: false |
76 | 83 | )
|
77 | 84 | end
|
78 | 85 |
|
|
82 | 89 | context 'when result is an "ok" type' do
|
83 | 90 | subject(:result) do
|
84 | 91 | described_class::Ok.new(
|
85 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 92 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 93 | + input_truncated: false |
86 | 94 | )
|
87 | 95 | end
|
88 | 96 |
|
89 | 97 | it { expect(result).not_to be_match }
|
90 | 98 | end
|
91 | 99 |
|
92 | 100 | context 'when result is an "error" type' do
|
93 |
| - subject(:result) { described_class::Error.new(duration_ext_ns: 0) } |
| 101 | + subject(:result) { described_class::Error.new(duration_ext_ns: 0, input_truncated: false) } |
94 | 102 |
|
95 | 103 | it { expect(result).not_to be_match }
|
96 | 104 | end
|
|
100 | 108 | context 'when result is a generic type' do
|
101 | 109 | subject(:result) do
|
102 | 110 | described_class::Base.new(
|
103 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 111 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 112 | + input_truncated: false |
104 | 113 | )
|
105 | 114 | end
|
106 | 115 |
|
|
110 | 119 | context 'when result is a "match" type' do
|
111 | 120 | subject(:result) do
|
112 | 121 | described_class::Match.new(
|
113 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 122 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 123 | + input_truncated: false |
114 | 124 | )
|
115 | 125 | end
|
116 | 126 |
|
|
120 | 130 | context 'when result is an "ok" type' do
|
121 | 131 | subject(:result) do
|
122 | 132 | described_class::Ok.new(
|
123 |
| - events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0 |
| 133 | + events: [], actions: {}, derivatives: {}, timeout: false, duration_ns: 0, duration_ext_ns: 0, |
| 134 | + input_truncated: false |
124 | 135 | )
|
125 | 136 | end
|
126 | 137 |
|
127 | 138 | it { expect(result).not_to be_error }
|
128 | 139 | end
|
129 | 140 |
|
130 | 141 | context 'when result is an "error" type' do
|
131 |
| - subject(:result) { described_class::Error.new(duration_ext_ns: 0) } |
| 142 | + subject(:result) { described_class::Error.new(duration_ext_ns: 0, input_truncated: false) } |
132 | 143 |
|
133 | 144 | it { expect(result).to be_error }
|
134 | 145 | end
|
|
0 commit comments