* Improve snapshot testing Signed-off-by: Nick Cameron <nrc@ncameron.org> * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
		
			
				
	
	
		
			34 lines
		
	
	
		
			489 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			489 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
---
 | 
						|
source: kcl-lib/src/simulation_tests.rs
 | 
						|
description: Result of unparsing if_else.kcl
 | 
						|
---
 | 
						|
// This tests evaluating if-else expressions.
 | 
						|
 | 
						|
 | 
						|
a = if true {
 | 
						|
  3
 | 
						|
} else if true {
 | 
						|
  4
 | 
						|
} else {
 | 
						|
  5
 | 
						|
}
 | 
						|
assertEqual(a, 3, 0.001, "the 'if' branch gets returned")
 | 
						|
 | 
						|
b = if false {
 | 
						|
  3
 | 
						|
} else if true {
 | 
						|
  4
 | 
						|
} else {
 | 
						|
  5
 | 
						|
}
 | 
						|
assertEqual(b, 4, 0.001, "the 'else if' branch gets returned")
 | 
						|
 | 
						|
c = if false {
 | 
						|
  3
 | 
						|
} else if false {
 | 
						|
  4
 | 
						|
} else {
 | 
						|
  5
 | 
						|
}
 | 
						|
assertEqual(c, 5, 0.001, "the 'else' branch gets returned")
 |