Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// Unit tests for markdown. | 5 /// Unit tests for markdown. |
| 6 library markdown.test.markdown_test; | 6 library markdown.test.markdown_test; |
| 7 | 7 |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 import 'package:markdown/markdown.dart'; | 10 import 'package:markdown/markdown.dart'; |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1275 ''' | 1275 ''' |
| 1276 <p> | 1276 <p> |
| 1277 <a href="http://foo.com/foo.png" title="optional title"> | 1277 <a href="http://foo.com/foo.png" title="optional title"> |
| 1278 <img src="http://foo.com/foo.png" title="optional title"></img> | 1278 <img src="http://foo.com/foo.png" title="optional title"></img> |
| 1279 </a> | 1279 </a> |
| 1280 </p> | 1280 </p> |
| 1281 '''); | 1281 '''); |
| 1282 }); | 1282 }); |
| 1283 | 1283 |
| 1284 group('Resolver', () { | 1284 group('Resolver', () { |
| 1285 nyanResolver(text) => new Text('~=[,,_${text}_,,]:3'); | 1285 Node nyanResolver(String text) => new Text('~=[,,_${text}_,,]:3'); |
|
nweiz
2015/09/01 20:51:42
:(
Bob Nystrom
2015/09/01 21:14:58
<shrug> Small price to pay overall for better stat
| |
| 1286 | 1286 |
| 1287 validate( | 1287 validate( |
| 1288 'simple link resolver', | 1288 'simple link resolver', |
| 1289 ''' | 1289 ''' |
| 1290 resolve [this] thing | 1290 resolve [this] thing |
| 1291 ''', | 1291 ''', |
| 1292 ''' | 1292 ''' |
| 1293 <p>resolve ~=[,,_this_,,]:3 thing</p> | 1293 <p>resolve ~=[,,_this_,,]:3 thing</p> |
| 1294 ''', | 1294 ''', |
| 1295 linkResolver: nyanResolver); | 1295 linkResolver: nyanResolver); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1308 ''' | 1308 ''' |
| 1309 resolve [*star* _underline_] thing | 1309 resolve [*star* _underline_] thing |
| 1310 ''', | 1310 ''', |
| 1311 ''' | 1311 ''' |
| 1312 <p>resolve ~=[,,_*star* _underline__,,]:3 thing</p> | 1312 <p>resolve ~=[,,_*star* _underline__,,]:3 thing</p> |
| 1313 ''', | 1313 ''', |
| 1314 linkResolver: nyanResolver); | 1314 linkResolver: nyanResolver); |
| 1315 }); | 1315 }); |
| 1316 | 1316 |
| 1317 group('Custom inline syntax', () { | 1317 group('Custom inline syntax', () { |
| 1318 var nyanSyntax = [new TextSyntax('nyan', sub: '~=[,,_,,]:3')]; | |
| 1319 | |
| 1320 validate( | 1318 validate( |
| 1321 'simple inline syntax', | 1319 'simple inline syntax', |
| 1322 ''' | 1320 ''' |
| 1323 nyan | 1321 nyan |
| 1324 ''', | 1322 ''', |
| 1325 ''' | 1323 ''' |
| 1326 <p>~=[,,_,,]:3</p> | 1324 <p>~=[,,_,,]:3</p> |
| 1327 ''', | 1325 ''', |
| 1328 inlineSyntaxes: nyanSyntax); | 1326 inlineSyntaxes: [new TextSyntax('nyan', sub: '~=[,,_,,]:3')]); |
| 1329 | 1327 |
| 1330 validate('dart custom links', 'links [are<foo>] awesome', | 1328 validate('dart custom links', 'links [are<foo>] awesome', |
| 1331 '<p>links <a>are<foo></a> awesome</p>', | 1329 '<p>links <a>are<foo></a> awesome</p>', |
| 1332 linkResolver: (text) => | 1330 linkResolver: (text) => |
| 1333 new Element.text('a', text.replaceAll('<', '<'))); | 1331 new Element.text('a', text.replaceAll('<', '<'))); |
| 1334 | 1332 |
| 1335 // TODO(amouravski): need more tests here for custom syntaxes, as some | 1333 // TODO(amouravski): need more tests here for custom syntaxes, as some |
| 1336 // things are not quite working properly. The regexps are sometime a little | 1334 // things are not quite working properly. The regexps are sometime a little |
| 1337 // too greedy, I think. | 1335 // too greedy, I think. |
| 1338 }); | 1336 }); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1398 'ignores block-level markdown syntax', | 1396 'ignores block-level markdown syntax', |
| 1399 ''' | 1397 ''' |
| 1400 1. This will not be an <ol>. | 1398 1. This will not be an <ol>. |
| 1401 ''', | 1399 ''', |
| 1402 ''' | 1400 ''' |
| 1403 1. This will not be an <ol>. | 1401 1. This will not be an <ol>. |
| 1404 ''', | 1402 ''', |
| 1405 inlineOnly: true); | 1403 inlineOnly: true); |
| 1406 }); | 1404 }); |
| 1407 } | 1405 } |
| OLD | NEW |