Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:

- name: run tests
run: |
for tst in test/*; do $tst; done
for tst in test/*.sh; do $tst; done
13 changes: 12 additions & 1 deletion lib/misc_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function load_config() {

if [ -f $custom_config_file ];
then
source $custom_config_file
source_file $custom_config_file
assert_elixir_version_set $custom_config_file
fi

Expand Down Expand Up @@ -243,3 +243,14 @@ function fix_elixir_version() {
exit 1
fi
}

function source_file() {
local bkup_file=$(mktemp /tmp/buildpack_source_file_bkup.XXXX)

cp $1 $bkup_file

# sanitize the file to avoid any non-printable characters
LC_ALL=C tr -cd '\11\12\15\40-\176' < $bkup_file > $1
source $1
mv $bkup_file $1
}
40 changes: 40 additions & 0 deletions test/clean_config_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -e

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source $SCRIPT_DIR/.test_support.sh

# include source file
source $SCRIPT_DIR/../lib/misc_funcs.sh

# override functions
reset_test() {
EXIT_CODE=0
OUTPUT_LINES=()
}

exit() {
EXIT_CODE=$1
}
output_line() {
OUTPUT_LINES+=("$1")
}


# TESTS
######################
suite "clean_config_file"

test "handles unicode characters gracefully"

build_path="${SCRIPT_DIR}/config_files/unicode_chars"
load_config

[ "$EXIT_CODE" == 0 ]
[ "${elixir_version}" == "v1.19.1" ]
[ "${erlang_version}" == "27.3.4" ]



PASSED_ALL_TESTS=true
Binary file not shown.