Skip to content

Commit

Permalink
✅ test: update onmount test if sub app is not mounted to parent
Browse files Browse the repository at this point in the history
  • Loading branch information
balcieren committed Aug 19, 2022
1 parent 0d79f6a commit cb7b9d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ func Test_App_Mountpath(t *testing.T) {
func Test_App_OnMount(t *testing.T) {
app := New()
sub := New()
sub1 := New()

app.Use("/sub", sub)

Expand All @@ -359,6 +360,14 @@ func Test_App_OnMount(t *testing.T) {
utils.AssertEqual(t, parent != nil, true)
})

defer func() {
if err := recover(); err != nil {
utils.AssertEqual(t, "not mounted sub app to parent app", fmt.Sprintf("%s", err))
}
}()

sub1.OnMount(func(parent *App) {})

defer func() {
if err := recover(); err != nil {
utils.AssertEqual(t, "onmount cannot be used on parent app", fmt.Sprintf("%s", err))
Expand Down

1 comment on commit cb7b9d8

@ReneWerner87
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: cb7b9d8 Previous: 1fec875 Ratio
Benchmark_SlashRecognition/indexBytes 23.19 ns/op 0 B/op 0 allocs/op 4.901 ns/op 0 B/op 0 allocs/op 4.73
Benchmark_Cache 16018 ns/op 49367 B/op 6 allocs/op 376 ns/op 16 B/op 2 allocs/op 42.60
Benchmark_Cache_AdditionalHeaders 1348 ns/op 592 B/op 9 allocs/op 501.5 ns/op 16 B/op 2 allocs/op 2.69

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.