...
This commit is contained in:
@@ -9,18 +9,18 @@ import freeflowuniverse.herolib.ui.console
|
||||
fn main() {
|
||||
console.print_header('🔑 Hero SSH Agent Test Suite')
|
||||
os.execute('${os.dir(os.dir(@FILE))}/cli/compile.vsh')
|
||||
|
||||
|
||||
hero_bin := '${os.home_dir()}/hero/bin/hero'
|
||||
|
||||
|
||||
// Check if hero binary exists
|
||||
if !os.exists(hero_bin) {
|
||||
console.print_stderr('Hero binary not found at ${hero_bin}')
|
||||
console.print_stderr('Please compile hero first with: ./cli/compile.vsh')
|
||||
exit(1)
|
||||
}
|
||||
|
||||
|
||||
console.print_green('✓ Hero binary found at ${hero_bin}')
|
||||
|
||||
|
||||
// Test 1: Profile initialization
|
||||
console.print_header('Test 1: Profile Initialization')
|
||||
result1 := os.execute('${hero_bin} sshagent profile')
|
||||
@@ -29,17 +29,17 @@ fn main() {
|
||||
} else {
|
||||
console.print_stderr('❌ Profile initialization failed: ${result1.output}')
|
||||
}
|
||||
|
||||
|
||||
// Test 2: Status check
|
||||
console.print_header('Test 2: Status Check')
|
||||
result2 := os.execute('${hero_bin} sshagent status')
|
||||
if result2.exit_code == 0 && result2.output.contains("- SSH Agent Status") {
|
||||
if result2.exit_code == 0 && result2.output.contains('- SSH Agent Status') {
|
||||
console.print_green('✓ Status check successful')
|
||||
println(result2.output)
|
||||
} else {
|
||||
console.print_stderr('❌ Status check failed: ${result2.output}')
|
||||
}
|
||||
|
||||
|
||||
// Test 3: List keys
|
||||
console.print_header('Test 3: List SSH Keys')
|
||||
result3 := os.execute('${hero_bin} sshagent list')
|
||||
@@ -49,7 +49,7 @@ fn main() {
|
||||
} else {
|
||||
console.print_stderr('❌ List keys failed: ${result3.output}')
|
||||
}
|
||||
|
||||
|
||||
// Test 4: Generate test key
|
||||
console.print_header('Test 4: Generate Test Key')
|
||||
test_key_name := 'hero_test_${os.getpid()}'
|
||||
@@ -57,11 +57,11 @@ fn main() {
|
||||
if result4.exit_code == 0 && result4.output.contains('Generating SSH key') {
|
||||
console.print_green('✓ Key generation successful')
|
||||
println(result4.output)
|
||||
|
||||
|
||||
// Cleanup: remove test key files
|
||||
test_key_path := '${os.home_dir()}/.ssh/${test_key_name}'
|
||||
test_pub_path := '${test_key_path}.pub'
|
||||
|
||||
|
||||
if os.exists(test_key_path) {
|
||||
os.rm(test_key_path) or {}
|
||||
console.print_debug('Cleaned up test private key')
|
||||
@@ -73,7 +73,7 @@ fn main() {
|
||||
} else {
|
||||
console.print_stderr('❌ Key generation failed: ${result4.output}')
|
||||
}
|
||||
|
||||
|
||||
// Test 5: Help output
|
||||
console.print_header('Test 5: Help Output')
|
||||
result5 := os.execute('${hero_bin} sshagent')
|
||||
@@ -82,10 +82,10 @@ fn main() {
|
||||
} else {
|
||||
console.print_stderr('❌ Help output unexpected')
|
||||
}
|
||||
|
||||
|
||||
console.print_header('🎉 Test Suite Complete')
|
||||
console.print_green('Hero SSH Agent is ready for use!')
|
||||
|
||||
|
||||
// Show usage examples
|
||||
console.print_header('Usage Examples:')
|
||||
println('')
|
||||
|
||||
Reference in New Issue
Block a user