Source file src/runtime/synctest_test.go

     1  // Copyright 2024 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  package runtime_test
     6  
     7  import (
     8  	"internal/synctest"
     9  	"runtime"
    10  	"testing"
    11  )
    12  
    13  func TestSynctest(t *testing.T) {
    14  	output := runTestProg(t, "testsynctest", "")
    15  	want := "success\n"
    16  	if output != want {
    17  		t.Fatalf("output:\n%s\n\nwanted:\n%s", output, want)
    18  	}
    19  }
    20  
    21  // TestSynctestAssocConsts verifies that constants defined
    22  // in both runtime and internal/synctest match.
    23  func TestSynctestAssocConsts(t *testing.T) {
    24  	if runtime.BubbleAssocUnbubbled != synctest.Unbubbled ||
    25  		runtime.BubbleAssocCurrentBubble != synctest.CurrentBubble ||
    26  		runtime.BubbleAssocOtherBubble != synctest.OtherBubble {
    27  		t.Fatal("mismatch: runtime.BubbleAssoc? != synctest.*")
    28  	}
    29  }
    30  

View as plain text