Skip to content

Commit 92677a8

Browse files
Enhance path handling and testing for directory and file combinations
This commit introduces several improvements to the path handling API and increases test coverage: - Added operators for combining `AbsoluteDirectoryPath`, `RelativeDirectoryPath`, and `DirectoryPath` with `FileName`, allowing for seamless path construction. - Implemented comprehensive unit tests to validate the new operators and ensure correct behavior across various path types. - Enhanced existing tests for path conversion methods, including edge cases and null argument handling. - Introduced new test classes for path utility functions, ensuring robust coverage for path-related functionalities. These changes aim to improve the usability and reliability of the path handling features in the library.
1 parent 5a2ed3d commit 92677a8

9 files changed

Lines changed: 1626 additions & 21 deletions

File tree

.cursor/rules/derived-cursor-rules.mdc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,20 @@ When adding XML documentation comments:
258258
var userName = emailAddress.As<UserName>(); // Will infer the source type
259259
```
260260
* Leverages the existing `SemanticString<T>.Create<T>()` factory method.
261-
* **Path Interfaces - AsAbsolute Method**:
262-
* The `IFilePath` and `IDirectoryPath` interfaces include the `AsAbsolute()` method.
263-
* `AsAbsolute()` converts the path to an absolute path representation.
264-
* For relative paths, `AsAbsolute()` resolves against the current working directory.
265-
* For absolute paths, `AsAbsolute()` returns the path itself.
266-
* **Path Conversion API**:
261+
* **Path Interfaces**
262+
263+
* **Interface-Level AsAbsolute() Methods**:
264+
* `IAbsolutePath.AsAbsolute()` → returns `AbsolutePath`
265+
* `IRelativePath.AsAbsolute()` → returns `AbsolutePath`
266+
* `IAbsoluteFilePath.AsAbsolute()` → returns `AbsoluteFilePath`
267+
* `IRelativeFilePath.AsAbsolute()` → returns `AbsoluteFilePath`
268+
* `IAbsoluteDirectoryPath.AsAbsolute()` → returns `AbsoluteDirectoryPath`
269+
* `IRelativeDirectoryPath.AsAbsolute()` → returns `AbsoluteDirectoryPath`
270+
* **Consolidated Path Conversion API**:
271+
* `AsAbsolute()` - convert to absolute using current working directory
272+
* `AsAbsolute(baseDirectory)` - convert to absolute using specific base directory
273+
* `AsRelative(baseDirectory)` - convert to relative using specific base directory
274+
267275
* **API Design Principles**
268276
1. Consistent Naming: All conversion methods use the `As*()` prefix
269277
2. Clear Purpose: Different method signatures for different conversion scenarios
@@ -272,14 +280,7 @@ When adding XML documentation comments:
272280

273281
* **Complete API Reference**
274282

275-
#### **Interface-to-Concrete Conversions** (Type Casting)
276-
277-
* `AsAbsoluteFilePath()` - Cast interface to concrete absolute file path (REDUNDANT - REMOVE)
278-
* `AsRelativeFilePath()` - Cast interface to concrete relative file path (REDUNDANT - REMOVE)
279-
* `AsAbsoluteDirectoryPath()` - Cast interface to concrete absolute directory path (REDUNDANT - REMOVE)
280-
* `AsRelativeDirectoryPath()` - Cast interface to concrete relative directory path (REDUNDANT - REMOVE)
281-
282-
#### **Path Category Conversions** (Path Transformations)
283+
#### Path Category Conversions (Path Transformations)
283284

284285
* `AsAbsolute()` - Convert to absolute using current working directory
285286
* `AsAbsolute(baseDirectory)` - Convert to absolute using specific base directory
@@ -312,13 +313,11 @@ When adding XML documentation comments:
312313

313314
// Convert absolute to relative using base
314315
RelativeFilePath backToRelative = absoluteFile.AsRelative(baseDir);
315-
316-
// Interface conversions
317-
IAbsoluteFilePath iAbsFile = absoluteFile;
318-
AbsoluteFilePath concrete = iAbsFile.AsAbsoluteFilePath();
319316
```
320-
321-
* **Redundant Interface Conversions**: The interface conversion methods like `AsAbsoluteDirectoryPath()` are redundant given the consolidated `As*()` API and direct casting, and should be removed.
317+
* **Path Combination Operators:**
318+
* `AbsoluteDirectoryPath` now has an operator for combining with `FileName`.
319+
* `RelativeDirectoryPath` also has an operator for `FileName`.
320+
* The generic `DirectoryPath` type has an operator for `FileName` as well for consistency.
322321

323322
## DEBUGGING
324323

@@ -366,4 +365,5 @@ When adding XML documentation comments:
366365
| **Constant Access** | 5M ops/sec | **50M ops/sec** | ✅ |
367366
| **Cross-Domain Calculations** | 50K ops/sec | **1M ops/sec** | ✅ |
368367
* **Winget Manifest Generation:** Ensure the winget manifest generation script gracefully exits and reports errors clearly. Check that artifact name patterns in the script match the release files.
369-
* **Winget Manifest Generation - Library Project Handling:** The winget manifest generation script should correctly identify library-only projects and exit gracefully, avoiding attempts to download artifacts. The script should recognize projects using custom SDK files that contain `.Lib` or `Library` in their name (like `ktsu.Sdk.Lib`) as library projects. The script should also exclude projects using custom SDK files that contain `.Test`, `.Lib`, `Test`, or `Library` from being considered as applications.
368+
* **Winget Manifest Generation - Library Project Handling:** The winget manifest generation script should correctly identify library-only projects and exit gracefully, avoiding attempts to download artifacts. The script should recognize projects using custom SDK files that contain `.Lib` or `Library` in their name (like `ktsu.Sdk.Lib`) as library projects. The script should also exclude projects using custom SDK files that contain `.Test`, `.Lib`, `Test`, or `Library` from being considered as applications.
369+
* Investigate whether test coverage can be increased in the string or path files.

0 commit comments

Comments
 (0)