Home Download Docs Code Community
     1	/*
     2	Copyright 2012 The Perkeep Authors
     3	
     4	Licensed under the Apache License, Version 2.0 (the "License");
     5	you may not use this file except in compliance with the License.
     6	You may obtain a copy of the License at
     7	
     8	     http://www.apache.org/licenses/LICENSE-2.0
     9	
    10	Unless required by applicable law or agreed to in writing, software
    11	distributed under the License is distributed on an "AS IS" BASIS,
    12	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13	See the License for the specific language governing permissions and
    14	limitations under the License.
    15	*/
    16	
    17	package test
    18	
    19	import (
    20		"os"
    21		"strconv"
    22		"testing"
    23	)
    24	
    25	// DependencyErrorOrSkip is called when a test's dependency
    26	// isn't found. It either skips the current test (if SKIP_DEP_TESTS is set),
    27	// or calls t.Error with an error.
    28	func DependencyErrorOrSkip(t *testing.T) {
    29		b, _ := strconv.ParseBool(os.Getenv("SKIP_DEP_TESTS"))
    30		if b {
    31			t.Skip("SKIP_DEP_TESTS is set; skipping test.")
    32		}
    33		t.Error("External test dependencies not found, and environment SKIP_DEP_TESTS not set.")
    34	}
Website layout inspired by memcached.
Content by the authors.