...

Text file src/github.com/google/go-containerregistry/pkg/name/internal/must_test.sh

Documentation: github.com/google/go-containerregistry/pkg/name/internal

     1#!/bin/bash
     2
     3# Copyright 2021 Google LLC
     4#
     5# Licensed under the Apache License, Version 2.0 (the "License");
     6# you may not use this file except in compliance with the License.
     7# You may obtain a copy of the License at
     8#
     9#     http://www.apache.org/licenses/LICENSE-2.0
    10#
    11# Unless required by applicable law or agreed to in writing, software
    12# distributed under the License is distributed on an "AS IS" BASIS,
    13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14# See the License for the specific language governing permissions and
    15# limitations under the License.
    16
    17set -o nounset
    18set -o pipefail
    19
    20# Trying to compile without the build tag should work.
    21go test ./pkg/name/internal
    22
    23# Actually trying to compile should fail.
    24go test -tags=compile ./pkg/name/internal 2>&1 > /dev/null
    25if [[ $? -eq 0 ]]; then
    26  echo "pkg/name/internal test compiled successfully, expected failure"
    27  exit 1
    28fi
    29echo "pkg/name/internal test successfully did not compile"

View as plain text