Index: tests/compiler/dart2js/strip_comment_test.dart |
diff --git a/tests/compiler/dart2js/strip_comment_test.dart b/tests/compiler/dart2js/strip_comment_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c233ba883497cf04a40826cf4ad03cff985dc2a1 |
--- /dev/null |
+++ b/tests/compiler/dart2js/strip_comment_test.dart |
@@ -0,0 +1,79 @@ |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library strip_comment_test; |
+ |
+import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart'; |
+ |
+testComment(String strippedText, String commentText) { |
+ Expect.stringEquals(strippedText, stripComment(commentText)); |
+} |
+ |
+void main() { |
+ testComment('', '//'); |
+ testComment('', '// '); |
+ testComment(' ', '// '); |
+ testComment('foo bar baz', '//foo bar baz'); |
+ testComment('foo bar baz', '// foo bar baz'); |
+ testComment('foo bar baz ', '// foo bar baz '); |
+ testComment(' foo bar baz ', '// foo bar baz '); |
+ |
+ testComment('', '///'); |
+ testComment('', '/// '); |
+ testComment(' ', '/// '); |
+ testComment('foo bar baz', '///foo bar baz'); |
+ testComment('foo bar baz', '/// foo bar baz'); |
+ testComment('foo bar baz ', '/// foo bar baz '); |
+ testComment(' foo bar baz ', '/// foo bar baz '); |
+ |
+ testComment('', '/**/'); |
+ testComment('', '/* */'); |
+ testComment(' ', '/* */'); |
+ testComment('foo bar baz', '/*foo bar baz*/'); |
+ testComment('foo bar baz', '/* foo bar baz*/'); |
+ testComment('foo bar baz ', '/* foo bar baz */'); |
+ testComment(' foo bar baz ', '/* foo bar baz */'); |
+ testComment('foo\nbar\nbaz', '/*foo\nbar\nbaz*/'); |
+ testComment('foo\nbar\nbaz', '/* foo\nbar\nbaz*/'); |
+ testComment('foo \n bar \n baz ', '/* foo \n bar \n baz */'); |
+ testComment('foo\nbar\nbaz', '/* foo\n *bar\n *baz*/'); |
+ testComment('foo\nbar\nbaz', '/* foo\n * bar\n * baz*/'); |
+ testComment('foo \nbar \nbaz ', '/* foo \n * bar \n * baz */'); |
+ testComment('\nfoo\nbar\nbaz', |
+ '''/* |
+ * foo |
+ * bar |
+ * baz*/'''); |
+ testComment('\nfoo\nbar\nbaz\n', |
+ '''/* |
+ * foo |
+ * bar |
+ * baz |
+ */'''); |
+ |
+ testComment('', '/***/'); |
+ testComment('', '/** */'); |
+ testComment(' ', '/** */'); |
+ testComment('foo bar baz', '/**foo bar baz*/'); |
+ testComment('foo bar baz', '/** foo bar baz*/'); |
+ testComment('foo bar baz ', '/** foo bar baz */'); |
+ testComment(' foo bar baz ', '/** foo bar baz */'); |
+ testComment('foo\nbar\nbaz', '/**foo\nbar\nbaz*/'); |
+ testComment('foo\nbar\nbaz', '/** foo\nbar\nbaz*/'); |
+ testComment('foo \n bar \n baz ', '/** foo \n bar \n baz */'); |
+ testComment('foo\nbar\nbaz', '/** foo\n *bar\n *baz*/'); |
+ testComment('foo\nbar\nbaz', '/** foo\n * bar\n * baz*/'); |
+ testComment('foo \nbar \nbaz ', '/** foo \n * bar \n * baz */'); |
+ testComment('\nfoo\nbar\nbaz', |
+ '''/** |
+ * foo |
+ * bar |
+ * baz*/'''); |
+ testComment('\nfoo\nbar\nbaz\n', |
+ '''/** |
+ * foo |
+ * bar |
+ * baz |
+ */'''); |
+} |