-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(minor): Add more thorough setup/teardown hooks (#153)
Adding support for global, shared and local setup/teardown hooks in a systemic manner. Fixes #142 Co-authored-by: dimlio <[email protected]>
- Loading branch information
Showing
7 changed files
with
243 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Joakim Hassila on 2023-04-21. | ||
// | ||
|
||
import Benchmark | ||
|
||
func sharedSetup() { | ||
// print("Shared setup hook") | ||
} | ||
|
||
func sharedTeardown() { | ||
// print("Shared teardown hook") | ||
} | ||
|
||
func testSetUpTearDown() { | ||
// Benchmark.setup = { print("Global setup hook") } | ||
// Benchmark.teardown = { print("Global teardown hook") } | ||
|
||
Benchmark("SetupTeardown", | ||
configuration: .init(setup: sharedSetup, teardown: sharedTeardown)) { _ in | ||
} setup: { | ||
// print("Local setup hook") | ||
} teardown: { | ||
// print("Local teardown hook") | ||
} | ||
|
||
Benchmark("SetupTeardown2", | ||
configuration: .init(setup: sharedSetup, teardown: sharedTeardown)) { _ in | ||
} | ||
|
||
Benchmark("SetupTeardown3", | ||
configuration: .init(setup: sharedSetup)) { _ in | ||
} teardown: { | ||
// print("Local teardown hook") | ||
} | ||
|
||
Benchmark("SetupTeardown4", | ||
configuration: .init(setup: sharedSetup)) { _ in | ||
} setup: { | ||
// print("Local setup hook") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters