|
1359 | 1359 | end |
1360 | 1360 |
|
1361 | 1361 | context ':TYPE' do |
| 1362 | + shared_examples 'a type matcher' do |type| |
| 1363 | + it "matches #{type}" do |
| 1364 | + token = lexer.tokenise(type).first |
| 1365 | + expect(token.type).to eq(:TYPE) |
| 1366 | + expect(token.value).to eq(type) |
| 1367 | + end |
| 1368 | + end |
| 1369 | + |
1362 | 1370 | it 'matches Data Types' do |
1363 | 1371 | token = lexer.tokenise('Integer').first |
1364 | 1372 | expect(token.type).to eq(:TYPE) |
|
1378 | 1386 | end |
1379 | 1387 |
|
1380 | 1388 | describe 'Platform Types' do |
1381 | | - it 'matches Callable' do |
1382 | | - token = lexer.tokenise('Callable').first |
1383 | | - expect(token.type).to eq(:TYPE) |
1384 | | - expect(token.value).to eq('Callable') |
1385 | | - end |
1386 | | - |
1387 | | - it 'matches Sensitive' do |
1388 | | - token = lexer.tokenise('Sensitive').first |
1389 | | - expect(token.type).to eq(:TYPE) |
1390 | | - expect(token.value).to eq('Sensitive') |
1391 | | - end |
| 1389 | + it_behaves_like 'a type matcher', 'Callable' |
| 1390 | + it_behaves_like 'a type matcher', 'Sensitive' |
1392 | 1391 | end |
1393 | 1392 |
|
1394 | | - it 'matches Error type' do |
1395 | | - token = lexer.tokenise('Error').first |
1396 | | - expect(token.type).to eq(:TYPE) |
1397 | | - expect(token.value).to eq('Error') |
1398 | | - end |
1399 | | - |
1400 | | - it 'matches Binary type' do |
1401 | | - token = lexer.tokenise('Binary').first |
1402 | | - expect(token.type).to eq(:TYPE) |
1403 | | - expect(token.value).to eq('Binary') |
1404 | | - end |
| 1393 | + it_behaves_like 'a type matcher', 'Error' |
| 1394 | + it_behaves_like 'a type matcher', 'Binary' |
1405 | 1395 | end |
1406 | 1396 |
|
1407 | 1397 | context ':HEREDOC without interpolation' do |
|
0 commit comments