add ui tests
This commit is contained in:
		
							parent
							
								
									f985dc4e5c
								
							
						
					
					
						commit
						91b1662302
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| test/*.expect | ||||
							
								
								
									
										4
									
								
								justfile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								justfile
									
									
									
									
									
								
							| @ -5,3 +5,7 @@ default: | ||||
| # run tests
 | ||||
| test: | ||||
|   for f in lib/*.test.fnl; do fennel $f | faucet; done | ||||
| 
 | ||||
| # build expect scripts
 | ||||
| expects: | ||||
|   for f in test/*.dat; do awk -f test/test.awk $f > ${f/dat/expect}; done | ||||
|  | ||||
							
								
								
									
										2
									
								
								main.fnl
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.fnl
									
									
									
									
									
								
							| @ -72,8 +72,6 @@ | ||||
|       2 ;; moving | ||||
|         (let [from (index-of-move (string.sub move 1 2)) | ||||
|               to  (index-of-move (string.sub move -2 -1))] | ||||
|             (print "From" from) | ||||
|             (print "To" to) | ||||
|             (tset self.moves from 0) | ||||
|             (tset self.moves to self.player) | ||||
|             (if (mill-at? self.moves to) | ||||
|  | ||||
							
								
								
									
										18
									
								
								test/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/README
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | ||||
| == ABOUT == | ||||
| 
 | ||||
| these files are to help me test the ui | ||||
| 
 | ||||
| moves are recorded in `<file>.dat`. | ||||
| then you can `awk -f test.awk file.dat > file.expect`. | ||||
| (or `just expects` to build them all.) | ||||
| then you can `expect file.expect` | ||||
| to have expect play the game for you up to a certain point. | ||||
| 
 | ||||
| == REQUIREMENTS == | ||||
| 
 | ||||
| - awk | ||||
| - expect | ||||
| 
 | ||||
| == FUTURE PLANS == | ||||
| 
 | ||||
| have actual integration tests? | ||||
							
								
								
									
										22
									
								
								test/moving-capture.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/moving-capture.dat
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| A1 | ||||
| A4 | ||||
| A7 | ||||
| b2 | ||||
| b4 | ||||
| b6 | ||||
| c3 | ||||
| c4 | ||||
| c5 | ||||
| d1 | ||||
| d2 | ||||
| d3 | ||||
| d5 | ||||
| d6 | ||||
| d7 | ||||
| e3 | ||||
| e4 | ||||
| e5 | ||||
| e4f4 | ||||
| e3e4 | ||||
| f4g4 | ||||
| d3e3 | ||||
							
								
								
									
										5
									
								
								test/placing-capture.dat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								test/placing-capture.dat
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| a1 | ||||
| b4 | ||||
| a4 | ||||
| b2 | ||||
| a7 | ||||
							
								
								
									
										12
									
								
								test/test.awk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								test/test.awk
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| BEGIN { | ||||
|   print "#!/usr/bin/expect -f" | ||||
|   print "spawn fennel main.fnl" | ||||
| } | ||||
| 
 | ||||
| { print "expect -re \"Player .'s turn:\"" | ||||
|   print "send -- \"" $0 "\\r\"" | ||||
| } | ||||
| 
 | ||||
| END { | ||||
|   print "interact" | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user