1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//! # Common Test Utilities
//!
//! This module provides reusable test utilities, mock implementations, and test fixtures
//! for the `sublime_pkg_tools` crate. It includes:
//!
//! - Mock implementations of external dependencies (filesystem, git, registry)
//! - Assertion helpers for common test scenarios
//! - Property-based testing generators
//! - Test fixture management
//!
//! ## Usage
//!
//! ```rust,ignore
//! use crate::common::{MockFileSystem, create_test_monorepo};
//!
//! #[tokio::test]
//! async fn test_with_mock_fs() {
//! let fs = MockFileSystem::new();
//! // Use the mock filesystem in your tests
//! }
//! ```
// Re-export commonly used items
// Note: Specific items are exported from submodules as needed by individual tests
use PathBuf;
/// Helper function to get the fixtures directory path
///
/// # Returns
///
/// Returns the absolute path to the test fixtures directory
///
/// # Examples
///
/// ```rust,ignore
/// let fixtures_path = fixtures_dir();
/// let monorepo_path = fixtures_path.join("monorepo");
/// ```
/// Helper function to get a specific fixture path
///
/// # Arguments
///
/// * `name` - The name of the fixture directory
///
/// # Returns
///
/// Returns the absolute path to the specified fixture
///
/// # Examples
///
/// ```rust,ignore
/// let monorepo = fixture_path("monorepo");
/// assert!(monorepo.exists());
/// ```
/// Creates a temporary directory for tests
///
/// # Returns
///
/// Returns a `tempfile::TempDir` that will be cleaned up when dropped
///
/// # Errors
///
/// Returns an error if the temporary directory cannot be created
///
/// # Examples
///
/// ```rust,ignore
/// let temp = create_temp_dir().unwrap();
/// let temp_path = temp.path();
/// // Use temp_path for tests
/// ```
/// Creates a temporary directory with a specific prefix
///
/// # Arguments
///
/// * `prefix` - The prefix for the temporary directory name
///
/// # Returns
///
/// Returns a `tempfile::TempDir` that will be cleaned up when dropped
///
/// # Errors
///
/// Returns an error if the temporary directory cannot be created
///
/// # Examples
///
/// ```rust,ignore
/// let temp = create_temp_dir_with_prefix("test-pkg").unwrap();
/// ```