tests: valgrind: string.replace()
							parent
							
								
									06540f0e91
								
							
						
					
					
						commit
						494f4fe986
					
				| 
						 | 
					@ -16,12 +16,24 @@ fn foo() {
 | 
				
			||||||
	//str_inter := 'hello, $name' // concatenated strings must be freed
 | 
						//str_inter := 'hello, $name' // concatenated strings must be freed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//nums.free() // this should result in a double free and a CI error
 | 
						//nums.free() // this should result in a double free and a CI error
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn str_replace() {
 | 
				
			||||||
 | 
						s := 'hello world'
 | 
				
			||||||
 | 
						r := s.replace('hello', 'hi')
 | 
				
			||||||
 | 
						cloned := s.replace('hello', 'hi').clone()
 | 
				
			||||||
 | 
						cloned2 := r.clone()
 | 
				
			||||||
 | 
						println(s)
 | 
				
			||||||
 | 
						println(r)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
	println('start')
 | 
						println('start')
 | 
				
			||||||
	foo()
 | 
						foo()
 | 
				
			||||||
 | 
						str_replace()
 | 
				
			||||||
	println('end')
 | 
						println('end')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue