...

Source file src/crypto/internal/boring/boring_test.go

Documentation: crypto/internal/boring

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Most functionality in this package is tested by replacing existing code
     6  // and inheriting that code's tests.
     7  
     8  package boring
     9  
    10  import "testing"
    11  
    12  // Test that func init does not panic.
    13  func TestInit(t *testing.T) {}
    14  
    15  // Test that Unreachable panics.
    16  func TestUnreachable(t *testing.T) {
    17  	defer func() {
    18  		if Enabled {
    19  			if err := recover(); err == nil {
    20  				t.Fatal("expected Unreachable to panic")
    21  			}
    22  		} else {
    23  			if err := recover(); err != nil {
    24  				t.Fatalf("expected Unreachable to be a no-op")
    25  			}
    26  		}
    27  	}()
    28  	Unreachable()
    29  }
    30  
    31  // Test that UnreachableExceptTests does not panic (this is a test).
    32  func TestUnreachableExceptTests(t *testing.T) {
    33  	UnreachableExceptTests()
    34  }
    35  

View as plain text