OILS / doctools / spelling_test.py View on Github | oils.pub

50 lines, 12 significant
1#!/usr/bin/env python2
2"""spelling_test.py: Tests for spelling.py."""
3from __future__ import print_function
4
5import unittest
6
7import spelling # module under test
8
9
10class SpellingTest(unittest.TestCase):
11
12 def testSplitWords(self):
13 # type: () -> None
14
15 docs = [
16 r'''
17 a b c # single chars left out
18 foo bar
19 http://google.com # url stripped
20 spam
21
22 https://google.com/?q=foo
23 file:///home/andy/git
24
25 aren't
26 can't
27
28 array[r'\']
29
30 ''',
31
32 # real test case from lynx -dump
33 '''
34 hi
35 9. file:///home/andy/git/oilshell/oil/_release/VERSION/doc/oil-language-faq.html#why-doesnt-a-raw-string-work-here-arrayr
36
37 bye
38
39 aren'tzzz
40 '''
41
42 # turns into "aren't", "zzz" which I guess is right
43 ]
44
45 for doc in docs:
46 print(list(spelling.SplitWords(doc)))
47
48
49if __name__ == '__main__':
50 unittest.main()