-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added support for array type in parser
- Loading branch information
1 parent
f5d25e7
commit a8c33fc
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package goparser | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// Contains all issues, reported on GitHub, for the goparser | ||
|
||
// Issue15 is a bug that notes that ArrayType is not implemented | ||
// `not-implemented typeSpec.Type.(type) = *ast.ArrayType`. | ||
func TestIssue15(t *testing.T) { | ||
src := `package foo | ||
type Color string | ||
type Label struct { | ||
Name string | ||
Description string | ||
color Color | ||
} | ||
// LabelSet is a custom slice type | ||
type LabelSet []Label` | ||
|
||
m := dummyModule() | ||
f, err := ParseInlineFile(m, m.Base+"/mypkg/file.go", src) | ||
require.NoError(t, err) | ||
require.NotNil(t, f) | ||
|
||
assert.Equal(t, "[]Label", f.CustomTypes[1].Type) | ||
assert.Equal(t, "type LabelSet []Label", f.CustomTypes[1].Decl) | ||
assert.Equal(t, "LabelSet is a custom slice type", f.CustomTypes[1].Doc) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.