Test case matches absolute paths on system
This commit is contained in:
		
							parent
							
								
									bb4a5472e1
								
							
						
					
					
						commit
						8ead560bfb
					
				| @ -11,3 +11,15 @@ func checkTree (modulePath string, skim bool, correct string, test *testing.T) { | ||||
| 	table, err := Analyze(modulePath, skim) | ||||
| 	testCommon.CheckStrings(test, table, err, correct) | ||||
| } | ||||
| 
 | ||||
| func resolvePath (path string) (resolved string) { | ||||
| 	var err error | ||||
| 	resolved, err = filepath.Abs(path) | ||||
| 	if err != nil { | ||||
| 		panic ( | ||||
| 			"could not resolve path (check test cases!): " + | ||||
| 			err.Error()) | ||||
| 	} | ||||
| 	resolved = filepath.Clean(resolved) | ||||
| 	return | ||||
| } | ||||
|  | ||||
| @ -5,7 +5,7 @@ import "testing" | ||||
| func TestTypeSection (test *testing.T) { | ||||
| 	checkTree ("../tests/analyzer/typeSection", false, | ||||
| ` | ||||
| typeSection ../tests/analyzer/typeSection.basicInt | ||||
| typeSection ` + resolvePath("../tests/analyzer/typeSection.basicInt") + ` | ||||
| 	type basic Int | ||||
| `, test) | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user