From 69a9f315119ff9ce7d91d1d058c8809ef565edfa Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Fri, 26 Mar 2021 22:28:35 +0100 Subject: [PATCH] Testing Is mdls enough? Yes, given some time. It looks like just installing shunit takes long enough for Spotlight to index.. --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ share/chxcode/chxcode | 2 +- test/chxcode_test | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index badf17e..9cb3500 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,31 @@ jobs: steps: - uses: actions/checkout@v2 + - name: mdls + run: mdls "$PWD/test/applications/Xcode.app" + + - name: mdfind + run: mdfind -onlyin "$PWD/test/applications" "kMDItemCFBundleIdentifier='com.apple.dt.Xcode'" + - name: Install shunit2 run: brew install shunit2 + - name: zzzz + run: | + while true; do + output="$(mdfind -onlyin "$PWD/test/applications" "kMDItemCFBundleIdentifier='com.apple.dt.Xcode'")" + if [ -z "$output" ]; then + echo "found '$output'" + break + else + echo "mdfind did not find any Xcodes" + sleep 1 + fi + done + + - name: mdfind + run: mdfind -onlyin "$PWD/test/applications" "kMDItemCFBundleIdentifier='com.apple.dt.Xcode'" + - name: Run tests run: make test diff --git a/share/chxcode/chxcode b/share/chxcode/chxcode index e411351..b54d1c2 100644 --- a/share/chxcode/chxcode +++ b/share/chxcode/chxcode @@ -26,7 +26,7 @@ xcode_versions() { versions=() for xcode in ${XCODES[*]}; do version=$(xcode_version "$xcode") - versions+=${version} + versions+=("$version") done IFS=$'\n' versions=($(sort -n <<<"${versions[*]}")); unset IFS diff --git a/test/chxcode_test b/test/chxcode_test index c2ebce1..934aff0 100644 --- a/test/chxcode_test +++ b/test/chxcode_test @@ -7,7 +7,7 @@ test_exec_with_no_arguments() { xcodes=$(chxcode | tr '\n' ' ' | xargs) - assertEquals "should print installed xcodes" "* 9.3 9.2" "$xcodes" + assertEquals "should print installed xcodes" "9.2 * 9.3" "$xcodes" } test_change_unknown_xcode_reports_error() {