<commit_before>package gobrake

import (
	"time"

	"github.com/jonboulle/clockwork"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var fakeClock = clockwork.NewFakeClock()

func init() {
	clock = fakeClock
}

var _ = Describe("RouteTrace", func() {
	It("supports nested spans", func() {
		trace := &RouteTrace{
			Start: clock.Now(),
		}

		trace.StartSpan("root")
		fakeClock.Advance(time.Millisecond)

		trace.StartSpan("nested1")
		fakeClock.Advance(time.Millisecond)

		trace.StartSpan("nested1")
		fakeClock.Advance(time.Millisecond)

		trace.EndSpan("nested1")

		fakeClock.Advance(time.Millisecond)
		trace.EndSpan("nested1")

		fakeClock.Advance(time.Millisecond)
		trace.EndSpan("root")

		Expect(trace.groups["root"]).To(BeNumerically("~", 2*time.Millisecond))
		Expect(trace.groups["nested1"]).To(BeNumerically("~", 3*time.Millisecond))
	})
})<commit_msg>Add test for other group<commit_after>package gobrake

import (
	"time"

	"github.com/jonboulle/clockwork"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var fakeClock = clockwork.NewFakeClock()

func init() {
	clock = fakeClock
}

var _ = Describe("RouteTrace", func() {
	It("supports nested spans", func() {
		trace := &RouteTrace{
			Start: clock.Now(),
		}

		trace.StartSpan("root")
		fakeClock.Advance(time.Millisecond)

		trace.StartSpan("nested1")
		fakeClock.Advance(time.Millisecond)

		trace.StartSpan("nested1")
		fakeClock.Advance(time.Millisecond)

		trace.EndSpan("nested1")

		fakeClock.Advance(time.Millisecond)
		trace.EndSpan("nested1")

		fakeClock.Advance(time.Millisecond)
		trace.EndSpan("root")

		Expect(trace.groups["root"]).To(BeNumerically("==", 2*time.Millisecond))
		Expect(trace.groups["nested1"]).To(BeNumerically("==", 3*time.Millisecond))
		Expect(trace.groups["other"]).To(BeNumerically("==", 0))
	})
})
{'fraction_non_alphanumeric': 0.17231947483588622, 'fraction_numerical': 0.008205689277899343, 'mean_word_length': 5.2, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7178523', 'n_tokens_mistral': 727, 'n_tokens_neox': 665, 'n_words': 86}