• Kirill Smelkov's avatar
    golang: tests: Normalize \r\n to \n in doctests on windows · 17c1d2fa
    Kirill Smelkov authored
    On windows print emits \r\n instead of just \n. Here is how e.g.
    test_defer_excchain_dump fails without normalization:
    
        E           Failed: not equal:
        E           Differences (unified diff with -expected +actual):
        E               @@ -1,42 +1,43 @@
        E               -Traceback (most recent call last):
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in _
        E               -    return f(*argv, **kw)
        E               -  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 42, in main
        E               -    raise RuntimeError("err")
        E               -RuntimeError: err
        E               -<BLANKLINE>
        E               -During handling of the above exception, another exception occurred:
        E               -<BLANKLINE>
        E               -Traceback (most recent call last):
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in __exit__
        E               -    ...
        E               -  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 31, in d1
        E               -    raise RuntimeError("d1: aaa")
        E               -RuntimeError: d1: aaa
        E               -<BLANKLINE>
        E               -During handling of the above exception, another exception occurred:
        E               -<BLANKLINE>
        E               -Traceback (most recent call last):
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in __exit__
        E               -    ...
        E               -  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 33, in d2
        E               -    1/0
        E               -ZeroDivisionError: ...
        E               -<BLANKLINE>
        E               -During handling of the above exception, another exception occurred:
        E               -<BLANKLINE>
        E               -Traceback (most recent call last):
        E               -  ... "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 45, in <module>
        E               -    main()
        E               -  ...
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in _
        E               -    with __goframe__:
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in __exit__
        E               -    ...
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in __exit__
        E               -    ...
        E               -  File "PYGOLANG/golang/__init__.py", line ..., in __exit__
        E               -    ...
        E               -  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 35, in d3
        E               -    raise RuntimeError("d3: bbb")
        E               -RuntimeError: d3: bbb
        E               +Traceback (most recent call last):
        E               +  File "PYGOLANG/golang/__init__.py", line 106, in _
        E               +    return f(*argv, **kw)
        E               +  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 42, in main
        E               +    raise RuntimeError("err")
        E               +RuntimeError: err
        E               +
        E               +During handling of the above exception, another exception occurred:
        E               +
        E               +Traceback (most recent call last):
        E               +  File "PYGOLANG/golang/__init__.py", line 183, in __exit__
        E               +    d()
        E               +  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 31, in d1
        E               +    raise RuntimeError("d1: aaa")
        E               +RuntimeError: d1: aaa
        E               +
        E               +During handling of the above exception, another exception occurred:
        E               +
        E               +Traceback (most recent call last):
        E               +  File "PYGOLANG/golang/__init__.py", line 183, in __exit__
        E               +    d()
        E               +  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 33, in d2
        E               +    1/0
        E               +ZeroDivisionError: division by zero
        E               +
        E               +During handling of the above exception, another exception occurred:
        E               +
        E               +Traceback (most recent call last):
        E               +  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 45, in <module>
        E               +    main()
        E               +  File "Z:\home\kirr\src\tools\go\pygo-win\1.wenv\lib\site-packages/decorator.py", line 232, in fun
        E               +    return caller(func, *(extras + args), **kw)
        E               +  File "PYGOLANG/golang/__init__.py", line 105, in _
        E               +    with __goframe__:
        E               +  File "PYGOLANG/golang/__init__.py", line 182, in __exit__
        E               +    with __goframe__:
        E               +  File "PYGOLANG/golang/__init__.py", line 182, in __exit__
        E               +    with __goframe__:
        E               +  File "PYGOLANG/golang/__init__.py", line 183, in __exit__
        E               +    d()
        E               +  File "PYGOLANG/golang/testprog/golang_test_defer_excchain.py", line 35, in d3
        E               +    raise RuntimeError("d3: bbb")
        E               +RuntimeError: d3: bbb
    17c1d2fa
golang_test.py 52.4 KB