mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-11-04 18:28:23 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			616 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			616 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
# quicktest runs the ShellCheck unit tests in an interpreted mode.
 | 
						|
# This allows running tests without compiling, which can be faster.
 | 
						|
# 'cabal test' remains the source of truth.
 | 
						|
 | 
						|
path=$(find . -type f -path './dist*/Paths_ShellCheck.hs' | sort | head -n 1)
 | 
						|
if [ -z "$path" ]
 | 
						|
then
 | 
						|
    echo >&2 "Unable to find Paths_ShellCheck.hs. Please 'cabal build' once."
 | 
						|
      exit 1
 | 
						|
fi
 | 
						|
path="${path%/*}"
 | 
						|
 | 
						|
 | 
						|
(
 | 
						|
var=$(echo 'main' | ghci -isrc -i"$path" test/shellcheck.hs 2>&1 | tee /dev/stderr)
 | 
						|
if [[ $var == *ExitSuccess* ]]
 | 
						|
then
 | 
						|
  exit 0
 | 
						|
else
 | 
						|
  grep -C 3 -e "Fail" -e "Tracing" <<< "$var"
 | 
						|
  exit 1
 | 
						|
fi
 | 
						|
) 2>&1
 |