MCPcopy Create free account
hub / github.com/douglance/devsql / create_test_repo

Function create_test_repo

crates/vcsql/tests/cli.rs:9–46  ·  view source on GitHub ↗

Creates a temporary Git repository for CLI testing.

()

Source from the content-addressed store, hash-verified

7
8/// Creates a temporary Git repository for CLI testing.
9fn create_test_repo() -> TempDir {
10 let temp = TempDir::new().expect("Failed to create temp dir");
11 let path = temp.path();
12
13 process::Command::new("git")
14 .args(["init"])
15 .current_dir(path)
16 .output()
17 .expect("Failed to init git repo");
18
19 process::Command::new("git")
20 .args(["config", "user.email", "test@example.com"])
21 .current_dir(path)
22 .output()
23 .expect("Failed to set email");
24
25 process::Command::new("git")
26 .args(["config", "user.name", "Test User"])
27 .current_dir(path)
28 .output()
29 .expect("Failed to set name");
30
31 std::fs::write(path.join("README.md"), "# Test\n").expect("Failed to write file");
32
33 process::Command::new("git")
34 .args(["add", "."])
35 .current_dir(path)
36 .output()
37 .expect("Failed to add files");
38
39 process::Command::new("git")
40 .args(["commit", "-m", "Initial commit"])
41 .current_dir(path)
42 .output()
43 .expect("Failed to commit");
44
45 temp
46}
47
48#[test]
49fn test_help() {

Callers 3

test_query_executionFunction · 0.70
test_json_outputFunction · 0.70
test_csv_outputFunction · 0.70

Calls 2

pathMethod · 0.80
writeFunction · 0.50

Tested by

no test coverage detected