| @@ 248-258 (lines=11) @@ | ||
| 245 | * @param string $type |
|
| 246 | * @param string $value |
|
| 247 | */ |
|
| 248 | public function testConsume($text, $spec, $success, $type, $value) |
|
| 249 | { |
|
| 250 | $stream = $this->makeStream($text); |
|
| 251 | $this->assertSame( |
|
| 252 | (bool)$success, |
|
| 253 | (bool)$stream->consume($spec), |
|
| 254 | "consume did not return " . ($success ? 'true' : 'false') |
|
| 255 | ); |
|
| 256 | $token = $stream->nextToken(); |
|
| 257 | $this->assertTokenEq($type, $value, $token); |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| 261 | * @return array |
|
| @@ 286-296 (lines=11) @@ | ||
| 283 | * @param string $type |
|
| 284 | * @param string $value |
|
| 285 | */ |
|
| 286 | public function testPeek($text, $spec, $success, $type, $value) |
|
| 287 | { |
|
| 288 | $stream = $this->makeStream($text); |
|
| 289 | $this->assertSame( |
|
| 290 | (bool)$success, |
|
| 291 | (bool)$stream->peek($spec), |
|
| 292 | "peek did not return " . ($success ? 'true' : 'false') |
|
| 293 | ); |
|
| 294 | $token = $stream->nextToken(); |
|
| 295 | $this->assertTokenEq($type, $value, $token); |
|
| 296 | } |
|
| 297 | ||
| 298 | /** |
|
| 299 | * @return array |
|