File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const STD = @import ("std" );
2+ const PATCH = @import ("patch.zig" );
3+
4+ const TEST_PATCHES_DIR = "tests/patches" ;
5+
6+ const ORIGINAL_FILES_DIR = TEST_PATCHES_DIR ++ "/" ++ "original" ;
7+
8+ const ORIGINAL_FILE_PATH = ORIGINAL_FILES_DIR ++ "/" ++ "original.txt" ;
9+
10+ const MODIFIED_FILES_DIR = TEST_PATCHES_DIR ++ "/" ++ "modified" ;
11+
12+ const MODIFIED_FILE_PATH = MODIFIED_FILES_DIR ++ "/" ++ "modified.txt" ;
13+
14+ fn initPatchTest () ! void {
15+ STD .fs .cwd ().access (ORIGINAL_FILES_DIR , .{}) catch {
16+ try STD .fs .cwd ().makePath (ORIGINAL_FILES_DIR );
17+ };
18+
19+ STD .fs .cwd ().access (MODIFIED_FILES_DIR , .{}) catch {
20+ try STD .fs .cwd ().makePath (MODIFIED_FILES_DIR );
21+ };
22+
23+ STD .fs .cwd ().access (ORIGINAL_FILE_PATH , .{}) catch {
24+ try STD .fs .cwd ().writeFile (.{ .sub_path = ORIGINAL_FILE_PATH , .data = "hello" , .flags = .{ .truncate = true } });
25+ };
26+
27+ STD .fs .cwd ().access (MODIFIED_FILE_PATH , .{}) catch {
28+ try STD .fs .cwd ().writeFile (.{ .sub_path = MODIFIED_FILE_PATH , .data = "hey" , .flags = .{ .truncate = true } });
29+ };
30+ }
31+
32+ test "patch system" {
33+ var allocator : STD.mem.Allocator = STD .testing .allocator ;
34+
35+ try PATCH .run (allocator );
36+ }
37+
38+ test "patch" {
39+ var allocator : STD.mem.Allocator = STD .testing .allocator ;
40+
41+ _ = allocator ;
42+ }
You can’t perform that action at this time.
0 commit comments