Skip to content

Commit d8a7ee3

Browse files
committed
add test
1 parent 9ffb95e commit d8a7ee3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Tests/TracingTests/TracerTests.swift

+11
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,17 @@ final class TracerTests: XCTestCase {
369369
tracer.withAnySpan("", context: .topLevel) { _ in }
370370
}
371371

372+
func testWithSpanShouldNotMissPropagatingInstant() {
373+
let tracer = TestTracer()
374+
let clock = DefaultTracerClock()
375+
376+
let instant = clock.now
377+
tracer.withAnySpan("span", at: instant) { _ in }
378+
379+
let span = tracer.spans.first!
380+
XCTAssertEqual(span.startTimestampNanosSinceEpoch, instant.nanosecondsSinceEpoch)
381+
}
382+
372383
#if swift(>=5.7.0)
373384
// @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
374385
/// Helper method to execute async operations until we can use async tests (currently incompatible with the generated LinuxMain file).

0 commit comments

Comments
 (0)