| 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 "package:expect/expect.dart"; |
| 8 import 'package:compiler/src/mirrors/mirrors_util.dart'; |
| 9 |
| 10 testComment(String strippedText, String commentText) { |
| 11 Expect.stringEquals(strippedText, stripComment(commentText)); |
| 12 } |
| 13 |
| 14 void main() { |
| 15 testComment('', '//'); |
| 16 testComment('', '// '); |
| 17 testComment(' ', '// '); |
| 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 testComment(' foo bar baz ', '// foo bar baz '); |
| 22 |
| 23 testComment('', '///'); |
| 24 testComment('', '/// '); |
| 25 testComment(' ', '/// '); |
| 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 testComment(' foo bar baz ', '/// foo bar baz '); |
| 30 |
| 31 testComment('', '/**/'); |
| 32 testComment('', '/* */'); |
| 33 testComment(' ', '/* */'); |
| 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 bar baz ', '/* foo bar baz */'); |
| 38 testComment('foo\nbar\nbaz', '/*foo\nbar\nbaz*/'); |
| 39 testComment('foo\nbar\nbaz', '/* foo\nbar\nbaz*/'); |
| 40 testComment('foo \n bar \n baz ', '/* 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('foo \nbar \nbaz ', '/* foo \n * bar \n * baz */'); |
| 44 testComment('\nfoo\nbar\nbaz', |
| 45 '''/* |
| 46 * foo |
| 47 * bar |
| 48 * baz*/'''); |
| 49 testComment('\nfoo\nbar\nbaz\n', |
| 50 '''/* |
| 51 * foo |
| 52 * bar |
| 53 * baz |
| 54 */'''); |
| 55 |
| 56 testComment('', '/***/'); |
| 57 testComment('', '/** */'); |
| 58 testComment(' ', '/** */'); |
| 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 bar baz ', '/** foo bar baz */'); |
| 63 testComment('foo\nbar\nbaz', '/**foo\nbar\nbaz*/'); |
| 64 testComment('foo\nbar\nbaz', '/** foo\nbar\nbaz*/'); |
| 65 testComment('foo \n bar \n baz ', '/** 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('foo \nbar \nbaz ', '/** foo \n * bar \n * baz */'); |
| 69 testComment('\nfoo\nbar\nbaz', |
| 70 '''/** |
| 71 * foo |
| 72 * bar |
| 73 * baz*/'''); |
| 74 testComment('\nfoo\nbar\nbaz\n', |
| 75 '''/** |
| 76 * foo |
| 77 * bar |
| 78 * baz |
| 79 */'''); |
| 80 } |
| OLD | NEW |