1use strict; 2use warnings; 3use utf8; 4use Regexp::Lexer qw(tokenize); 5use Regexp::Lexer::TokenType; 6 7use Test::More; 8use Test::Deep; 9 10subtest 'basic pass' => sub { 11 my $tokens = tokenize(qr{"\"\\"'\'\\'}); 12 cmp_deeply($tokens->{tokens}, [ 13 { 14 char => '"', 15 index => 1, 16 type => Regexp::Lexer::TokenType::DoubleQuote, 17 }, 18 { 19 char => '\\"', 20 index => 2, 21 type => Regexp::Lexer::TokenType::EscapedCharacter, 22 }, 23 { 24 char => '\\\\', 25 index => 3, 26 type => Regexp::Lexer::TokenType::EscapedCharacter, 27 }, 28 { 29 char => '"', 30 index => 4, 31 type => Regexp::Lexer::TokenType::DoubleQuote, 32 }, 33 { 34 char => q<'>, 35 index => 5, 36 type => Regexp::Lexer::TokenType::SingleQuote, 37 }, 38 { 39 char => q<\\'>, 40 index => 6, 41 type => Regexp::Lexer::TokenType::EscapedCharacter, 42 }, 43 { 44 char => '\\\\', 45 index => 7, 46 type => Regexp::Lexer::TokenType::EscapedCharacter, 47 }, 48 { 49 char => q<'>, 50 index => 8, 51 type => Regexp::Lexer::TokenType::SingleQuote, 52 }, 53 ]); 54}; 55 56done_testing; 57