~andyc/oils

485fd02ec4f3d31c3937f17709fabceedbe9a978 — Andy C 2 months ago f83de75
[test fix] Adjust error messages in unit and spec tests
3 files changed, 29 insertions(+), 29 deletions(-)

M osh/string_ops_test.py
M spec/var-op-len.test.sh
M spec/var-op-slice.test.sh
M osh/string_ops_test.py => osh/string_ops_test.py +7 -7
@@ 17,19 17,19 @@ class LibStrTest(unittest.TestCase):
            ([1, 3, 6, 10], '\x24\xC2\xA2\xE0\xA4\xB9\xF0\x90\x8D\x88'),
            ([
                1, 3,
                'UTF-8 Error: Bad Encoding at byte index 3 in string of length 6'
                'UTF-8 decode: Bad encoding at offset 3 in string of 6 bytes'
            ], '\x24\xC2\xA2\xE0\xE0\xA4'),
            ([
                1, 3, 6,
                'UTF-8 Error: Bad Encoding at byte index 6 in string of length 7'
                'UTF-8 decode: Bad encoding at offset 6 in string of 7 bytes'
            ], '\x24\xC2\xA2\xE0\xA4\xA4\xB9'),
            ([
                1, 3,
                'UTF-8 Error: Bad Encoding at byte index 3 in string of length 4'
                'UTF-8 decode: Bad encoding at offset 3 in string of 4 bytes'
            ], '\x24\xC2\xA2\xFF'),
            ([
                1,
                'UTF-8 Error: Truncated Bytes at byte index 1 in string of length 4'
                'UTF-8 decode: Truncated bytes at offset 1 in string of 4 bytes'
            ], '\x24\xF0\x90\x8D'),
        ]
        for expected_indexes, input_str in CASES:


@@ 70,11 70,11 @@ class LibStrTest(unittest.TestCase):

    def test_DecodeUtf8CharError(self):
        CASES = [
            ('UTF-8 Error: Truncated Bytes at byte index 0 in string of length 1',
            ('UTF-8 decode: Truncated bytes at offset 0 in string of 1 bytes',
             '\xC0'),
            ('UTF-8 Error: Bad Encoding at byte index 0 in string of length 2',
            ('UTF-8 decode: Bad encoding at offset 0 in string of 2 bytes',
             '\xC0\x01'),
            ('UTF-8 Error: Bad Encoding at byte index 0 in string of length 1',
            ('UTF-8 decode: Bad encoding at offset 0 in string of 1 bytes',
             '\xff'),
        ]
        for msg, input in CASES:

M spec/var-op-len.test.sh => spec/var-op-len.test.sh +21 -21
@@ 45,12 45,12 @@ true  # exit 0
-1
-1
7
[ stdin ]:3: warning: UTF-8 Error: Truncated Bytes at byte index 2 in string of length 3
[ stdin ]:3: warning: UTF-8 Error: Truncated Bytes at byte index 5 in string of length 6
[ stdin ]:3: warning: UTF-8 Error: Truncated Bytes at byte index 5 in string of length 7
[ stdin ]:3: warning: UTF-8 Error: Truncated Bytes at byte index 9 in string of length 10
[ stdin ]:3: warning: UTF-8 Error: Truncated Bytes at byte index 9 in string of length 11
[ stdin ]:3: warning: UTF-8 Error: Truncated Bytes at byte index 9 in string of length 12
[ stdin ]:3: warning: UTF-8 decode: Truncated bytes at offset 2 in string of 3 bytes
[ stdin ]:3: warning: UTF-8 decode: Truncated bytes at offset 5 in string of 6 bytes
[ stdin ]:3: warning: UTF-8 decode: Truncated bytes at offset 5 in string of 7 bytes
[ stdin ]:3: warning: UTF-8 decode: Truncated bytes at offset 9 in string of 10 bytes
[ stdin ]:3: warning: UTF-8 decode: Truncated bytes at offset 9 in string of 11 bytes
[ stdin ]:3: warning: UTF-8 decode: Truncated bytes at offset 9 in string of 12 bytes
## END
# zsh behavior actually matches bash!
## BUG bash/zsh stderr-json: ""


@@ 113,21 113,21 @@ true
-1
-1
-1
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 0 in string of length 1
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 1 in string of length 2
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 2 in string of length 3
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 2 in string of length 4
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 4 in string of length 5
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 5 in string of length 6
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 5 in string of length 7
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 5 in string of length 8
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 8 in string of length 9
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 9 in string of length 10
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 9 in string of length 11
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 9 in string of length 12
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 9 in string of length 13
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 13 in string of length 14
[ stdin ]:3: warning: UTF-8 Error: Bad Encoding at byte index 13 in string of length 14
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 0 in string of 1 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 1 in string of 2 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 2 in string of 3 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 2 in string of 4 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 4 in string of 5 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 5 in string of 6 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 5 in string of 7 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 5 in string of 8 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 8 in string of 9 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 9 in string of 10 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 9 in string of 11 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 9 in string of 12 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 9 in string of 13 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 13 in string of 14 bytes
[ stdin ]:3: warning: UTF-8 decode: Bad encoding at offset 13 in string of 14 bytes
## END
## BUG bash/zsh stderr-json: ""
## BUG bash/zsh STDOUT:

M spec/var-op-slice.test.sh => spec/var-op-slice.test.sh +1 -1
@@ 109,7 109,7 @@ echo -${s:1:3}-
--
## END
## STDERR:
[??? no location ???] warning: UTF-8 Error: Bad Encoding at byte index 0 in string of length 6
[??? no location ???] warning: UTF-8 decode: Bad encoding at offset 0 in string of 6 bytes
## END
## BUG bash/mksh/zsh status: 0
## BUG bash/mksh/zsh STDOUT: