1# Copyright David Abrahams 2004. Distributed under the Boost
2# Software License, Version 1.0. (See accompanying
3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4from __future__ import print_function
5"""
6>>> from str_ext import *
7>>> def printer(*args):
8...     for x in args: print(x, end='')
9...     print('')
10...
11>>> work_with_string(printer) #doctest: +NORMALIZE_WHITESPACE
12['this', 'is', 'a', 'demo', 'string']
13['this', 'is', 'a', 'demo string']
14this<->is<->a<->demo<->string
15This is a demo string
16[    this is a demo string     ]
172
18this is a demo string
19this is a demo string
20['this is a demo string']
21this is a demo string
22THIS IS A DEMO STRING
23This Is A Demo String
24find
2510
2610 3 5
2710
2810
29expandtabs
30                tab     demo    !
31        tab demo    !
32              tab    demo   !
33operators
34part1part2
35this is a blabla string
3618
3718
38aaaaaaaaaaaaaaaaaaaaa
39"""
40
41def run(args = None):
42    import sys
43    import doctest
44
45    if args is not None:
46        sys.argv = args
47    return doctest.testmod(sys.modules.get(__name__))
48
49if __name__ == '__main__':
50    print("running...")
51    import sys
52    status = run()[0]
53    if (status == 0): print("Done.")
54    sys.exit(status)
55