Results for var-op-slice.test.sh

statusoshosh_.pyosh_.cc
pass 1694
ok 333
FAIL 1813
total202020
caseoshosh_.pyosh_.ccdescription
0pass pass FAIL String slice
details
1ok ok ok Cannot take length of substring slice
detailsdetailsdetails
2pass pass FAIL Out of range string slice: begin
details
3pass pass FAIL Out of range string slice: length
details
4ok ok ok String slice: negative begin
detailsdetailsdetails
5ok ok ok String slice: negative second arg is position, not length
detailsdetailsdetails
6pass pass pass strict_word_eval with string slice
7pass pass FAIL String slice with math
details
8pass pass pass Slice undefined
9pass pass FAIL Slice UTF-8 String
details
10pass FAIL FAIL Slice string with invalid UTF-8 results in empty string and warning
detailsdetails
11pass FAIL FAIL Slice string with invalid UTF-8 with strict_word_eval
detailsdetails
12pass pass pass Slice with an index that's an array itself not allowed
13pass pass pass Slice with an assoc array
14pass FAIL FAIL Simple ${@:offset}
detailsdetails
15pass FAIL FAIL ${@:offset} and ${*:offset}
detailsdetails
16pass FAIL FAIL ${@:offset:length} and ${*:offset:length}
detailsdetails
17pass FAIL FAIL ${@:0:1}
detailsdetails
18pass FAIL FAIL ${array[@]::0}
detailsdetails
19FAIL FAIL FAIL ${array[@]::}
detailsdetailsdetails
29 passed, 9 OK, 0 not implemented, 0 BUG, 22 failed, 0 timeouts, 0 cases skipped
1 failed under osh

Details on runs that didn't PASS

osh_.cc0 String slice

[osh_.cc stdout] Expected 'bcd\n', got 'abcdefg\n'

stdout:
abcdefg
stderr:
osh1 Cannot take length of substring slice

stdout:
stderr: 
  echo ${#v:1:3}
           ^
[ stdin ]:2: Expected } after length expression
osh_.py1 Cannot take length of substring slice

stdout:
stderr: 
  echo ${#v:1:3}
           ^
[ stdin ]:2: Expected } after length expression
osh_.cc1 Cannot take length of substring slice

stdout:
stderr: 
  echo ${#v:1:3}
           ^
[ stdin ]:2: Expected } after length expression
osh_.cc2 Out of range string slice: begin

[osh_.cc stdout] Expected '_\n0\n', got '_abcdefg\n0\n'

stdout:
_abcdefg
0
stderr:
osh_.cc3 Out of range string slice: length

[osh_.cc stdout] Expected '_defg\n0\n', got '_abcdefg\n0\n'

stdout:
_abcdefg
0
stderr:
osh4 String slice: negative begin

stdout:
stderr: 
  echo ${foo: -4:3}
       ^~
[ stdin ]:2: warning: The start index of a string slice can't be negative: -4
osh_.py4 String slice: negative begin

stdout:
stderr: 
  echo ${foo: -4:3}
       ^~
[ stdin ]:2: warning: The start index of a string slice can't be negative: -4
osh_.cc4 String slice: negative begin

stdout:
stderr: 
[??? no location ???] warning: The start index of a string slice can't be negative: -4
osh5 String slice: negative second arg is position, not length

stdout:
stderr: 
  echo ${foo:3:-1} ${foo: 3: -2} ${foo:3 :-3 }
       ^~
[ stdin ]:2: warning: The length of a string slice can't be negative: -1
  echo ${foo:3:-1} ${foo: 3: -2} ${foo:3 :-3 }
                   ^~
[ stdin ]:2: warning: The length of a string slice can't be negative: -2
  echo ${foo:3:-1} ${foo: 3: -2} ${foo:3 :-3 }
                                 ^~
[ stdin ]:2: warning: The length of a string slice can't be negative: -3
osh_.py5 String slice: negative second arg is position, not length

stdout:
stderr: 
  echo ${foo:3:-1} ${foo: 3: -2} ${foo:3 :-3 }
       ^~
[ stdin ]:2: warning: The length of a string slice can't be negative: -1
  echo ${foo:3:-1} ${foo: 3: -2} ${foo:3 :-3 }
                   ^~
[ stdin ]:2: warning: The length of a string slice can't be negative: -2
  echo ${foo:3:-1} ${foo: 3: -2} ${foo:3 :-3 }
                                 ^~
[ stdin ]:2: warning: The length of a string slice can't be negative: -3
osh_.cc5 String slice: negative second arg is position, not length

stdout:
stderr: 
[??? no location ???] warning: The length of a string slice can't be negative: -1
[??? no location ???] warning: The length of a string slice can't be negative: -2
[??? no location ???] warning: The length of a string slice can't be negative: -3
osh_.cc7 String slice with math

[osh_.cc stdout] Expected 'def\n', got 'abcdefg\n'

stdout:
abcdefg
stderr:
osh_.cc9 Slice UTF-8 String

[osh_.cc stdout] Expected '-\xce\xbc-\n', got '--\xce\xbc--\n'

stdout:
--μ--
stderr:
osh_.py10 Slice string with invalid UTF-8 results in empty string and warning

[osh_.py stdout] Expected '--\n', got ''
[osh_.py stderr] Expected '[??? no location ???] warning: Invalid start of UTF-8 character\n', got 'Traceback (most recent call last):\n File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 341, in <module>\n status = main(sys.argv)\n File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 228, in main\n status = main_loop.Batch(cmd_ev, c_parser, arena, is_main=True)\n File "/home/andy/git/oilshell/oil/core/main_loop.py", line 165, in Batch\n is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, optimize=optimize)\n File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1450, in ExecuteAndCatch\n status = self._Execute(node)\n File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1334, in _Execute\n status, check_errexit = self._Dispatch(node)\n File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 830, in _Dispatch\n val = self.word_ev.EvalRhsWord(pair.rhs)\n File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1588, in EvalRhsWord\n return self.EvalWordToString(w)\n File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1484, in EvalWordToString\n self._EvalWordPart(p, part_vals, quoted=False)\n File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1318, in _EvalWordPart\n sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t\n File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1945, in _EvalCommandSub\n stdout = self.shell_ex.RunCommandSub(node)\nAttributeError: \'NoneType\' object has no attribute \'RunCommandSub\'\n'
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 341, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 228, in main
    status = main_loop.Batch(cmd_ev, c_parser, arena, is_main=True)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 165, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, optimize=optimize)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1450, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1334, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 830, in _Dispatch
    val = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1588, in EvalRhsWord
    return self.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1484, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1318, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1945, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc10 Slice string with invalid UTF-8 results in empty string and warning

[osh_.cc stdout] Expected '--\n', got '-bcdef-\n'
[osh_.cc stderr] Expected '[??? no location ???] warning: Invalid start of UTF-8 character\n', got ''

stdout:
-bcdef-
stderr:
osh_.py11 Slice string with invalid UTF-8 with strict_word_eval

[osh_.py stderr] Found 'Traceback (most recent'

stdout:
slice
stderr:
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 341, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 228, in main
    status = main_loop.Batch(cmd_ev, c_parser, arena, is_main=True)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 165, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, optimize=optimize)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1450, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1334, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 830, in _Dispatch
    val = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1588, in EvalRhsWord
    return self.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1484, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1318, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1945, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc11 Slice string with invalid UTF-8 with strict_word_eval

[osh_.cc stdout] Expected 'slice\n', got 'slice\n-bcdef-\n'
[osh_.cc status] Expected 1, got 0

stdout:
slice
-bcdef-
stderr:
osh_.py14 Simple ${@:offset}

[osh_.py stdout] Expected "['SHELL', '4', '5', '6']\n['4', '5', '6']\n['5', '6']\n", got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
set 5
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 341, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 228, in main
    status = main_loop.Batch(cmd_ev, c_parser, arena, is_main=True)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 165, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, optimize=optimize)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1450, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1334, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 830, in _Dispatch
    val = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1588, in EvalRhsWord
    return self.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1484, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1318, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1945, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc14 Simple ${@:offset}

[osh_.cc stdout] Expected "['SHELL', '4', '5', '6']\n['4', '5', '6']\n['5', '6']\n", got "\n(cmd_value.Argv argv:[argv.py '/home/andy/git/oilshell/oil/_bin/osh_eval.dbg'] arg_spids:[36 38])\n(cmd_value.Argv argv:[argv.py '/home/andy/git/oilshell/oil/_bin/osh_eval.dbg'] arg_spids:[44 46])\n"

stdout:
(cmd_value.Argv argv:[argv.py '/home/andy/git/oilshell/oil/_bin/osh_eval.dbg'] arg_spids:[36 38])
(cmd_value.Argv argv:[argv.py '/home/andy/git/oilshell/oil/_bin/osh_eval.dbg'] arg_spids:[44 46])
stderr:
set 5
Unhandled SimpleCommand
Unhandled SimpleCommand
osh_.py15 ${@:offset} and ${*:offset}

[osh_.py stdout] Expected "['-SHELL', 'a', '1', 'b', '2', 'c', '3-']\n['-a', '1', 'b', '2', 'c', '3-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL', 'a', '1', 'b', '2', 'c', '3-']\n['-a', '1', 'b', '2', 'c', '3-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL a 1 b 2 c 3-']\n['-a 1 b 2 c 3-']\n['-c 3-']\n['--']\n['--']\n['-SHELL', 'a 1', 'b 2', 'c 3-']\n['-a 1', 'b 2', 'c 3-']\n['-c 3-']\n['--']\n['--']\n", got "(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[305 307 311 315])\n"

stdout:
(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[305 307 311 315])
stderr:
Unhandled SimpleCommand
osh_.cc15 ${@:offset} and ${*:offset}

[osh_.cc stdout] Expected "['-SHELL', 'a', '1', 'b', '2', 'c', '3-']\n['-a', '1', 'b', '2', 'c', '3-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL', 'a', '1', 'b', '2', 'c', '3-']\n['-a', '1', 'b', '2', 'c', '3-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL a 1 b 2 c 3-']\n['-a 1 b 2 c 3-']\n['-c 3-']\n['--']\n['--']\n['-SHELL', 'a 1', 'b 2', 'c 3-']\n['-a 1', 'b 2', 'c 3-']\n['-c 3-']\n['--']\n['--']\n", got "(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[305 307 311 315])\n"

stdout:
(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[305 307 311 315])
stderr:
Unhandled SimpleCommand
osh_.py16 ${@:offset:length} and ${*:offset:length}

[osh_.py stdout] Expected "['-SHELL', 'a', '1-']\n['-a', '1', 'b', '2-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL', 'a', '1-']\n['-a', '1', 'b', '2-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL a 1-']\n['-a 1 b 2-']\n['-c 3-']\n['--']\n['--']\n['-SHELL', 'a 1-']\n['-a 1', 'b 2-']\n['-c 3-']\n['--']\n['--']\n", got "(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[345 347 351 355])\n"

stdout:
(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[345 347 351 355])
stderr:
Unhandled SimpleCommand
osh_.cc16 ${@:offset:length} and ${*:offset:length}

[osh_.cc stdout] Expected "['-SHELL', 'a', '1-']\n['-a', '1', 'b', '2-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL', 'a', '1-']\n['-a', '1', 'b', '2-']\n['-c', '3-']\n['--']\n['--']\n['-SHELL a 1-']\n['-a 1 b 2-']\n['-c 3-']\n['--']\n['--']\n['-SHELL', 'a 1-']\n['-a 1', 'b 2-']\n['-c 3-']\n['--']\n['--']\n", got "(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[345 347 351 355])\n"

stdout:
(cmd_value.Argv argv:[fun 'a 1' 'b 2' 'c 3'] arg_spids:[345 347 351 355])
stderr:
Unhandled SimpleCommand
osh_.py17 ${@:0:1}

[osh_.py stdout] Expected 'SHELL\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
set 4
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 341, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 228, in main
    status = main_loop.Batch(cmd_ev, c_parser, arena, is_main=True)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 165, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, optimize=optimize)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1450, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1334, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 830, in _Dispatch
    val = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1588, in EvalRhsWord
    return self.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1484, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1318, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1945, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc17 ${@:0:1}

[osh_.cc stdout] Expected 'SHELL\n', got '\n'

stdout:
stderr: 
set 4
osh_.py18 ${array[@]::0}

[osh_.py stdout] Expected '[]\n', got '(cmd_value.Argv argv:[argv.py] arg_spids:[9])\n'

stdout:
(cmd_value.Argv argv:[argv.py] arg_spids:[9])
stderr:
Unhandled SimpleCommand
osh_.cc18 ${array[@]::0}

[osh_.cc stdout] Expected '[]\n', got '(cmd_value.Argv argv:[argv.py 1 2 3] arg_spids:[9 11 11 11])\n'

stdout:
(cmd_value.Argv argv:[argv.py 1 2 3] arg_spids:[9 11 11 11])
stderr:
Unhandled SimpleCommand
osh19 ${array[@]::}

[osh stdout] Expected '[]\n', got ''
[osh status] Expected 0, got 2

stdout:
stderr: 
  argv.py ${array[@]::}
                      ^
[ stdin ]:2: Token can't be used in prefix position
osh_.py19 ${array[@]::}

[osh_.py stdout] Expected '[]\n', got ''
[osh_.py status] Expected 0, got 2

stdout:
stderr: 
  argv.py ${array[@]::}
                      ^
[ stdin ]:2: Token can't be used in prefix position
osh_.cc19 ${array[@]::}

[osh_.cc stdout] Expected '[]\n', got ''
[osh_.cc status] Expected 0, got 2

stdout:
stderr: 
  argv.py ${array[@]::}
                      ^
[ stdin ]:2: Token can't be used in prefix position