Skip to content

Commit 4d7222c

Browse files
committed
chore(go-runner): add example with mod replace
1 parent 2580533 commit 4d7222c

7 files changed

Lines changed: 63 additions & 0 deletions

File tree

‎go-runner/src/integration_tests.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ fn assert_results_snapshots(profile_dir: &Path, project_name: &str) {
8181
#[case::example_with_dot_go_folder("example-with-dot-go-folder")]
8282
#[case::example_with_vendor("example-with-vendor")]
8383
#[case::example_with_test_package("example-with-test-package")]
84+
#[case::example_with_replace("example-with-replace")]
8485
#[test_log::test]
8586
fn test_build_and_run(#[case] project_name: &str) {
8687
let project_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
source: go-runner/src/integration_tests.rs
3+
expression: results
4+
---
5+
[
6+
{
7+
"creator": {
8+
"name": "codspeed-go",
9+
"version": "[version]",
10+
"pid": "[pid]"
11+
},
12+
"instrument": {
13+
"type": "walltime"
14+
},
15+
"benchmarks": [
16+
{
17+
"name": "BenchmarkGetValue",
18+
"uri": "go-runner/testdata/projects/example-with-replace/main_test.go::BenchmarkGetValue",
19+
"config": {
20+
"warmup_time_ns": null,
21+
"min_round_time_ns": null,
22+
"max_time_ns": null,
23+
"max_rounds": null
24+
},
25+
"stats": "[stats]"
26+
}
27+
]
28+
}
29+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package dep
2+
3+
func GetValue() int {
4+
return 42
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module example-with-replace/dep
2+
3+
go 1.24.3
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module example-with-replace
2+
3+
go 1.24.3
4+
5+
require example-with-replace/dep v0.0.0
6+
7+
replace example-with-replace/dep => ./dep
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "example-with-replace/dep"
4+
5+
func GetValue() int {
6+
return dep.GetValue()
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func BenchmarkGetValue(b *testing.B) {
8+
for i := 0; i < b.N; i++ {
9+
GetValue()
10+
}
11+
}

0 commit comments

Comments
 (0)