Skip to content

Commit

Permalink
fix test file names
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhang committed Aug 15, 2023
1 parent 0e64bdb commit 70203d8
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 56 deletions.
30 changes: 30 additions & 0 deletions internal/fxreflect/stack_120_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//go:build !go1.21
// +build !go1.21

package fxreflect

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestDeepStack(t *testing.T) {
t.Run("nest", func(t *testing.T) {
// Introduce a few frames.
frames := func() []Frame {
return func() []Frame {
return CallerStack(0, 0)
}()
}()

require.True(t, len(frames) > 3, "expected at least three frames")
for i, name := range []string{"func1.1.1", "func1.1", "func1"} {
f := frames[i]
assert.Equal(t, "go.uber.org/fx/internal/fxreflect.TestDeepStack."+name, f.Function)
assert.Contains(t, f.File, "internal/fxreflect/stack_120_test.go")
assert.NotZero(t, f.Line)
}
})
}
30 changes: 30 additions & 0 deletions internal/fxreflect/stack_121_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//go:build go1.21
// +build go1.21

package fxreflect

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestDeepStack(t *testing.T) {
t.Run("nest", func(t *testing.T) {
// Introduce a few frames.
frames := func() []Frame {
return func() []Frame {
return CallerStack(0, 0)
}()
}()

require.True(t, len(frames) > 3, "expected at least three frames")
for i, name := range []string{"func1.TestDeepStack.func1.1.func2", "func1.1", "func1"} {
f := frames[i]
assert.Equal(t, "go.uber.org/fx/internal/fxreflect.TestDeepStack."+name, f.Function)
assert.Contains(t, f.File, "internal/fxreflect/stack_121_test.go")
assert.NotZero(t, f.Line)
}
})
}
28 changes: 0 additions & 28 deletions internal/fxreflect/stack_test_120.go

This file was deleted.

28 changes: 0 additions & 28 deletions internal/fxreflect/stack_test_121.go

This file was deleted.

0 comments on commit 70203d8

Please sign in to comment.