buildpack-stdlib icon indicating copy to clipboard operation
buildpack-stdlib copied to clipboard

Problems with the set_env tests

Open edmorley opened this issue 8 years ago • 0 comments

  1. The same test is repeated twice:
@test "results of set_env" {
  set_env hello world

  result1="$(cat $PROFILE_PATH)"
  result2="$(cat $EXPORT_PATH)"

  [ "$result1" = "export hello=world" ]
  [ "$result2" = "export hello=world" ]
}

@test "results of set_env" {
  set_env hello world

  result1="$(cat $PROFILE_PATH)"
  result2="$(cat $EXPORT_PATH)"

  [ "$result1" = "export hello=world" ]
  [ "$result2" = "export hello=world" ]
}
  1. The bats tests setup() method sets hello world manually itself, which overlaps with the tests. This seems like it would obscure set_env not working in the test itself.

  2. There should probably be a few more tests to (a) ensure that later calls of set_env don't overwrite the earlier profile script, (b) make sure environment variable values with spaces are supported (and similar edge cases).

edmorley avatar Jul 24 '17 19:07 edmorley