#!/bin/bash # Quick test script for NIP set -e echo "๐Ÿงช Testing NIP..." echo "" # Test binary exists and runs echo "1. Testing binary execution..." if ./nip --help > /dev/null 2>&1; then echo " โœ… Binary executes successfully" else echo " โŒ Binary execution failed" exit 1 fi # Test version command echo "2. Testing version command..." if ./nip --version > /dev/null 2>&1; then echo " โœ… Version command works" else echo " โŒ Version command failed" exit 1 fi # Test config command (no root needed) echo "3. Testing config command..." if ./nip config show > /dev/null 2>&1; then echo " โœ… Config command works" else echo " โŒ Config command failed" exit 1 fi # Test platform command echo "4. Testing platform command..." if ./nip platform > /dev/null 2>&1; then echo " โœ… Platform command works" else echo " โŒ Platform command failed" exit 1 fi # Test logs command echo "5. Testing logs command..." if ./nip logs 5 > /dev/null 2>&1; then echo " โœ… Logs command works" else echo " โŒ Logs command failed" exit 1 fi # Test setup command (will fail without root, but should not crash) echo "6. Testing setup command..." if ./nip setup > /dev/null 2>&1; then echo " โœ… Setup command works" elif [ $? -eq 1 ]; then echo " โœ… Setup command works (requires root)" fi echo "7. Testing config init..." rm -f ~/.nip/config if ./nip config init > /dev/null 2>&1; then echo " โœ… Config init works" if [ -f ~/.nip/config ]; then echo " โœ… Config file created" else echo " โŒ Config file not created" exit 1 fi fi # Test help system echo "8. Testing help system..." if ./nip --help | grep -q "Universal Package"; then echo " โœ… Help system works" else echo " โŒ Help system failed" exit 1 fi echo "" echo "โœ… All tests passed!"