Skip to content

Commit 509aff4

Browse files
committed
Extract correct function in test setup
1 parent 82fbfa2 commit 509aff4

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

bin/install

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ sanitize_cxxflags_for_modern_php() {
158158
local icu_prefix
159159
icu_prefix=$(brew --prefix icu4c 2>/dev/null || echo "")
160160
if [ -n "$icu_prefix" ] && [ -e "$icu_prefix" ]; then
161-
local icu_version
161+
local icu_version icu_major
162162
icu_version=$("${icu_prefix}/bin/icu-config" --version 2>/dev/null || echo "0")
163-
if [[ "$icu_version" > "61" ]]; then
163+
icu_major=$(echo "$icu_version" | cut -d. -f1)
164+
if [ "$icu_major" -gt 61 ]; then
164165
stripped_cxxflags="-stdlib=libc++ -DU_USING_ICU_NAMESPACE=1"
165-
elif [[ "$icu_version" > "59" ]]; then
166+
elif [ "$icu_major" -gt 59 ]; then
166167
stripped_cxxflags="-stdlib=libc++"
167168
fi
168169
fi

tests/install_cxxflags.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ setup() {
99

1010
# Extract only the target function to avoid executing the rest of the install
1111
# script which has side effects (php-build setup, version resolution, etc.)
12-
sed -n '/^# Prior PHP installations via ICU/,/^}$/p' \
12+
sed -n '/^sanitize_cxxflags_for_modern_php()/,/^}$/p' \
1313
"${PLUGIN_DIR}/bin/install" > "${TEST_TEMP_DIR}/function.sh"
1414
source "${TEST_TEMP_DIR}/function.sh"
1515
}

0 commit comments

Comments
 (0)