OILS / doctools / spelling_test.py View on Github | oilshell.org

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