test(tazjin/rlox): Add simple string assertions
Change-Id: I6c60934d57170157d877e71cc87a97ab773342b5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2581 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									851e32cfe7
								
							
						
					
					
						commit
						bcea8e0d16
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
					@ -18,6 +18,10 @@ fn expect_bool(code: &str, value: bool) {
 | 
				
			||||||
    expect(code, Value::Bool(value))
 | 
					    expect(code, Value::Bool(value))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn expect_str(code: &str, value: &str) {
 | 
				
			||||||
 | 
					    expect(code, Value::String(value.to_string().into()))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[test]
 | 
					#[test]
 | 
				
			||||||
fn numbers() {
 | 
					fn numbers() {
 | 
				
			||||||
    expect_num("1", 1.0);
 | 
					    expect_num("1", 1.0);
 | 
				
			||||||
| 
						 | 
					@ -98,3 +102,9 @@ fn comparisons() {
 | 
				
			||||||
    expect_bool("42 >= 42", true);
 | 
					    expect_bool("42 >= 42", true);
 | 
				
			||||||
    expect_bool("42 >= 23", true);
 | 
					    expect_bool("42 >= 23", true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[test]
 | 
				
			||||||
 | 
					fn strings() {
 | 
				
			||||||
 | 
					    expect_str("\"hello\"", "hello");
 | 
				
			||||||
 | 
					    expect_str("\"hello\" + \" world\"", "hello world");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue