<commit_before>#!/usr/bin/env bash

set -euo pipefail

cd "${0%/*}" || exit 2

global_should_find() {
    local expect_num_matches symbol result
    expect_num_matches=$1
    symbol=$2

    set +e
    global -x --literal "$symbol" | wc -l | grep "$expect_num_matches" >/dev/null
    result=$?
    set -e

    if [[ $result -ne 0 ]]; then
        echo "Test failed (expect $expect_num_matches match): $symbol"
        global -x --literal "$symbol"
        exit 1
    fi
}

SYMBOLS_GLOBAL_SHOULD_FIND_ONE=(
    '@less-str'
    '#less-id-line1'
    '#less-id-line2'
    .less-class-line1
    .less-class-line2
    less-div.class-with-elem1
    less-div.class-with-elem2
    '@less-font-size'<commit_msg>Simplify checking for command exit status<commit_after>#!/usr/bin/env bash

set -euo pipefail

cd "${0%/*}" || exit 2

global_should_find() {
    local expect_num_matches symbol
    expect_num_matches=$1
    symbol=$2

    if ! global -x --literal "$symbol" | wc -l | grep "$expect_num_matches" >/dev/null; then
        echo "Test failed (expect $expect_num_matches match): $symbol"
        global -x --literal "$symbol"
        exit 1
    fi
}

SYMBOLS_GLOBAL_SHOULD_FIND_ONE=(
    '@less-str'
    '#less-id-line1'
    '#less-id-line2'
    .less-class-line1
    .less-class-line2
    less-div.class-with-elem1
    less-div.class-with-elem2
    '@less-font-size'
{'fraction_non_alphanumeric': 0.14243759177679882, 'fraction_numerical': 0.016886930983847283, 'mean_word_length': 2.6346666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7086465', 'n_tokens_mistral': 512, 'n_tokens_neox': 501, 'n_words': 111}