OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library strip_comment_test; |
| 6 |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.
dart'; |
| 8 |
| 9 testComment(String strippedText, String commentText) { |
| 10 Expect.stringEquals(strippedText, stripComment(commentText)); |
| 11 } |
| 12 |
| 13 void main() { |
| 14 testComment('', '//'); |
| 15 testComment('', '// '); |
| 16 testComment(' ', '// '); |
| 17 testComment('foo bar baz', '//foo bar baz'); |
| 18 testComment('foo bar baz', '// foo bar baz'); |
| 19 testComment('foo bar baz ', '// foo bar baz '); |
| 20 testComment(' foo bar baz ', '// foo bar baz '); |
| 21 |
| 22 testComment('', '///'); |
| 23 testComment('', '/// '); |
| 24 testComment(' ', '/// '); |
| 25 testComment('foo bar baz', '///foo bar baz'); |
| 26 testComment('foo bar baz', '/// foo bar baz'); |
| 27 testComment('foo bar baz ', '/// foo bar baz '); |
| 28 testComment(' foo bar baz ', '/// foo bar baz '); |
| 29 |
| 30 testComment('', '/**/'); |
| 31 testComment('', '/* */'); |
| 32 testComment(' ', '/* */'); |
| 33 testComment('foo bar baz', '/*foo bar baz*/'); |
| 34 testComment('foo bar baz', '/* foo bar baz*/'); |
| 35 testComment('foo bar baz ', '/* foo bar baz */'); |
| 36 testComment(' foo bar baz ', '/* foo bar baz */'); |
| 37 testComment('foo\nbar\nbaz', '/*foo\nbar\nbaz*/'); |
| 38 testComment('foo\nbar\nbaz', '/* foo\nbar\nbaz*/'); |
| 39 testComment('foo \n bar \n baz ', '/* foo \n bar \n baz */'); |
| 40 testComment('foo\nbar\nbaz', '/* foo\n *bar\n *baz*/'); |
| 41 testComment('foo\nbar\nbaz', '/* foo\n * bar\n * baz*/'); |
| 42 testComment('foo \nbar \nbaz ', '/* foo \n * bar \n * baz */'); |
| 43 testComment('\nfoo\nbar\nbaz', |
| 44 '''/* |
| 45 * foo |
| 46 * bar |
| 47 * baz*/'''); |
| 48 testComment('\nfoo\nbar\nbaz\n', |
| 49 '''/* |
| 50 * foo |
| 51 * bar |
| 52 * baz |
| 53 */'''); |
| 54 |
| 55 testComment('', '/***/'); |
| 56 testComment('', '/** */'); |
| 57 testComment(' ', '/** */'); |
| 58 testComment('foo bar baz', '/**foo bar baz*/'); |
| 59 testComment('foo bar baz', '/** foo bar baz*/'); |
| 60 testComment('foo bar baz ', '/** foo bar baz */'); |
| 61 testComment(' foo bar baz ', '/** foo bar baz */'); |
| 62 testComment('foo\nbar\nbaz', '/**foo\nbar\nbaz*/'); |
| 63 testComment('foo\nbar\nbaz', '/** foo\nbar\nbaz*/'); |
| 64 testComment('foo \n bar \n baz ', '/** foo \n bar \n baz */'); |
| 65 testComment('foo\nbar\nbaz', '/** foo\n *bar\n *baz*/'); |
| 66 testComment('foo\nbar\nbaz', '/** foo\n * bar\n * baz*/'); |
| 67 testComment('foo \nbar \nbaz ', '/** foo \n * bar \n * baz */'); |
| 68 testComment('\nfoo\nbar\nbaz', |
| 69 '''/** |
| 70 * foo |
| 71 * bar |
| 72 * baz*/'''); |
| 73 testComment('\nfoo\nbar\nbaz\n', |
| 74 '''/** |
| 75 * foo |
| 76 * bar |
| 77 * baz |
| 78 */'''); |
| 79 } |
OLD | NEW |