test: improve test suite

- Remove unnecessary debug print statements.
- Remove redundant initialization calls.
- Improve test cache handling and error reporting.
- Refactor code for better readability and maintainability.
- Update test suite to include additional tests.
- Improve code formatting and style consistency.
This commit is contained in:
Mahmoud-Emad
2024-12-26 10:14:37 +00:00
parent 4373ec21aa
commit da44604910
5 changed files with 186 additions and 213 deletions

View File

@@ -62,7 +62,6 @@ pub fn get(args_ GitStructureArgGet) !&GitStructure {
cachereset()!
}
rediskey_ := rediskey(args.coderoot)
// println(rediskey_)
// Return existing instance if already created.
if rediskey_ in gsinstances {
@@ -96,8 +95,6 @@ pub fn get(args_ GitStructureArgGet) !&GitStructure {
if args.reload {
gs.load()!
} else {
gs.init()!
}
gsinstances[rediskey_] = &gs

View File

@@ -42,9 +42,9 @@ pub mut:
// - args (StatusUpdateArgs): Arguments controlling the reload behavior.
pub fn (mut gitstructure GitStructure) load(args StatusUpdateArgs) ! {
mut processed_paths := []string{}
// println("1")
println('1')
gitstructure.load_recursive(gitstructure.coderoot.path, mut processed_paths)!
// println("2")
println('2')
if args.reload {
mut ths := []thread !{}
@@ -68,18 +68,16 @@ pub fn (mut gitstructure GitStructure) load(args StatusUpdateArgs) ! {
// exit(0)
}
gitstructure.init()!
// gitstructure.init()!
}
// just some initialization mechanism
pub fn (mut gitstructure GitStructure) init() ! {
if gitstructure.config.debug {
gitstructure.config.log = true
}
if gitstructure.repos.keys().len == 0 {
gitstructure.load()!
}
}
// // just some initialization mechanism
// pub fn (mut gitstructure GitStructure) init() ! {
// if gitstructure.repos.keys().len == 0 {
// println('Before loading keys.')
// gitstructure.load()!
// }
// }
// Recursively loads repositories from the provided path, updating their statuses.
//