Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BASH] _SHUNIT_LINENO_ error if IFS is redefined #167

Open
Maxouwell opened this issue Mar 24, 2023 · 4 comments
Open

[BASH] _SHUNIT_LINENO_ error if IFS is redefined #167

Maxouwell opened this issue Mar 24, 2023 · 4 comments

Comments

@Maxouwell
Copy link

Maxouwell commented Mar 24, 2023

The ${_SHUNIT_LINENO_} call at the start of assert* functions fails if IFS is redefined

#!/usr/bin/env bash

function test_SHUNIT_LINENO_bug() {
  local var=1

  PREVIOUS_FIELD_SEPARATOR=$IFS
  IFS=,
  assertEquals "$var" "$var" >&2
  IFS=$PREVIOUS_FIELD_SEPARATOR
}

source shunit2

result in

test_SHUNIT_LINENO_bug
shunit2: line 176: eval __shunit_lineno=""; if ${__SHUNIT_BUILTIN} [ "${1:-}" = "--lineno" ] && ${__SHUNIT_BUILTIN} [ -n "${2:-}" ]; then __shunit_lineno="[${2}]"; shift 2; fi;: command not found

Ran 1 test.

OK

Bash version (On Ubuntu in WSL2)

bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)                    
Copyright (C) 2019 Free Software Foundation, Inc.                            
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
                                                                             
This is free software; you are free to change and redistribute it.           
There is NO WARRANTY, to the extent permitted by law.                 
@williamdes
Copy link
Collaborator

What shunit2 version are you using ?

@Maxouwell
Copy link
Author

2.1.9pre

@williamdes
Copy link
Collaborator

Can you try the latest version just to be sure?

@Maxouwell
Copy link
Author

If by latest version you mean the shunit file on master, yes, the same behaviour is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants