<commit_before># shellcheck source=./test_runner.sh
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_runner.sh
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

test_scala_proto_library_action_label() {
  cd third_party/test/proto
  local expected="action 'scala //:proto'"
  local action=$(bazel aquery --include_aspects 'mnemonic("Scalac", //...)' | grep ^action | head -n 1)
  if [ "$action" != "$expected" ]; then
    echo "Expected \"$expected\" but got \"$action\""
    exit 1
  fi
}

test_scala_proto_custom_generator() {
  bazel test //test/proto/custom_generator:DummyGeneratorTest \
  --extra_toolchains=//test/proto/custom_generator:scala_proto_deps_toolchain \
  --extra_toolchains=//test/proto/custom_generator:scala_proto_toolchain
}

test_scala_proto_show_generator_exception() {
  action_should_fail_with_message \
    "java.lang.RuntimeException: expected generator failure" \
    build //test/proto/custom_generator:any_proto_scala \
    --extra_toolchains=//test/proto/custom_generator:failing_scala_proto_deps_toolchain \
    --extra_toolchains=//test/proto/custom_generator:failing_scala_proto_toolchain
}

export USE_BAZEL_VERSION=${USE_BAZEL_VERSION:-$(cat ../../../.bazelversion)}
$runner test_scala_proto_library_action_label
$runner test_scala_proto_custom_generator
$runner test_scala_proto_show_generator_exception<commit_msg>Fix test_scala_proto_library to accept @-prefixed labels (#1418)<commit_after># shellcheck source=./test_runner.sh
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_runner.sh
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

test_scala_proto_library_action_label() {
  cd third_party/test/proto
  local expected="action 'scala @{0,2}//:proto'"
  local action=$(bazel aquery --include_aspects 'mnemonic("Scalac", //...)' | grep ^action | head -n 1)
  if [ "$action" != $expected ]; then
    echo "Expected \"$expected\" but got \"$action\""
    exit 1
  fi
}

test_scala_proto_custom_generator() {
  bazel test //test/proto/custom_generator:DummyGeneratorTest \
  --extra_toolchains=//test/proto/custom_generator:scala_proto_deps_toolchain \
  --extra_toolchains=//test/proto/custom_generator:scala_proto_toolchain
}

test_scala_proto_show_generator_exception() {
  action_should_fail_with_message \
    "java.lang.RuntimeException: expected generator failure" \
    build //test/proto/custom_generator:any_proto_scala \
    --extra_toolchains=//test/proto/custom_generator:failing_scala_proto_deps_toolchain \
    --extra_toolchains=//test/proto/custom_generator:failing_scala_proto_toolchain
}

export USE_BAZEL_VERSION=${USE_BAZEL_VERSION:-$(cat ../../../.bazelversion)}
$runner test_scala_proto_library_action_label
$runner test_scala_proto_custom_generator
$runner test_scala_proto_show_generator_exception
{'fraction_non_alphanumeric': 0.13983797111659035, 'fraction_numerical': 0.004931313842902431, 'mean_word_length': 5.543778801843318, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3817496', 'n_tokens_mistral': 990, 'n_tokens_neox': 936, 'n_words': 139}