Added ToString for SectionTable

This commit is contained in:
Sasha Koshka 2022-09-17 23:29:11 -04:00
parent 955f8b4719
commit 744e8de794
3 changed files with 26 additions and 0 deletions

View File

@ -15,6 +15,15 @@ func (where locator) ToString () (output string) {
// and all sections that it requires from other modules. // and all sections that it requires from other modules.
type SectionTable map[locator] Section type SectionTable map[locator] Section
// ToString returns the data stored in the table as a string.
func (table SectionTable) ToString (indent int) (output string) {
for _, section := range table {
output += section.ToString(indent)
}
return
}
// SectionKind differentiates Section interfaces. // SectionKind differentiates Section interfaces.
type SectionKind int type SectionKind int

13
analyzer/test-common.go Normal file
View File

@ -0,0 +1,13 @@
package analyzer
import "os"
import "testing"
import "path/filepath"
import "git.tebibyte.media/arf/arf/testCommon"
func checkTree (modulePath string, skim bool, correct string, test *testing.T) {
cwd, _ := os.Getwd()
modulePath = filepath.Join(cwd, modulePath)
table, err := Analyze(modulePath, skim)
testCommon.CheckStrings(test, table, err, correct)
}

View File

@ -0,0 +1,4 @@
:arf
---
type basicInt:Int:<5>