Просмотр исходного кода

Added tests for quoted strings and regexes using alternative delimiters

Matthew D. Miller 6 лет назад
Родитель
Сommit
6feaf43d1d
1 измененных файлов с 35 добавлено и 0 удалено
  1. 35 0
      src/perl/perl.test.ts

+ 35 - 0
src/perl/perl.test.ts

@@ -429,4 +429,39 @@ testTokenization('perl', [
 			],
 		},
 	],
+
+  // Quoted constructs
+	[
+		{
+			line: "m!can't!",
+			tokens: [
+				{ startIndex: 0, type: 'regexp.delim.perl' },
+				{ startIndex: 2, type: 'regexp.perl' },
+				{ startIndex: 7, type: 'regexp.delim.perl' },
+			],
+		},
+	],
+
+	[
+		{
+			line: 'q XfooX',
+			tokens: [
+				{ startIndex: 0, type: 'string.delim.perl' },
+				{ startIndex: 3, type: 'string.perl' },
+				{ startIndex: 6, type: 'string.delim.perl' },
+			],
+		},
+	],
+
+	[
+		{
+			line: 'qq(test $foo)',
+			tokens: [
+				{ startIndex: 0, type: 'string.delim.perl' },
+				{ startIndex: 3, type: 'string.perl' },
+				{ startIndex: 8, type: 'variable.perl' },
+        { startIndex: 12, type: 'string.delim.perl' },
+			],
+		},
+	],
 ]);