MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / build_source

Function build_source

atomic-agent/src/record/tests.rs:1058–1067  ·  view source on GitHub ↗

Build a Go-like source file with `count` distinct top-level functions, each with a unique, greppable marker line.

(count: usize)

Source from the content-addressed store, hash-verified

1056/// Build a Go-like source file with `count` distinct top-level functions,
1057/// each with a unique, greppable marker line.
1058fn build_source(count: usize) -> String {
1059 let mut out = String::new();
1060 out.push_str("package main\n\n");
1061 for i in 0..count {
1062 out.push_str(&format!(
1063 "func step{i}() int {{\n // marker[{i}]\n return {i}\n}}\n\n"
1064 ));
1065 }
1066 out
1067}
1068
1069fn count_occurrences(content: &str, pattern: &str) -> usize {
1070 content.matches(pattern).count()

Calls

no outgoing calls

Tested by

no test coverage detected