Skip to content

Commit

Permalink
feat: add test case for incell-scalar-list in struct-list
Browse files Browse the repository at this point in the history
  • Loading branch information
wenchy committed Mar 12, 2024
1 parent 3e7b640 commit abc638b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/importer/book/book.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (b *Book) ParseMetaAndPurge() (err error) {
}

if len(b.meta.MetasheetMap) == 0 {
// need all sheets except the metasheet "@TABLEAU"
// need all sheets except the MetasheetName and BookNameInMetasheet
b.meta.MetasheetMap = make(map[string]*tableaupb.Metasheet) // init
for _, sheet := range b.GetSheets() {
if sheet.Name != MetasheetName && sheet.Name != BookNameInMetasheet {
Expand Down
2 changes: 1 addition & 1 deletion internal/importer/book/sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// of each worksheet. Default is "@TABLEAU".
var MetasheetName = "@TABLEAU"

// BookNameInMetasheet is the name which represents workbook in metasheet.
// BookNameInMetasheet is the special sign which represents workbook itself in metasheet.
// Default is "#".
const BookNameInMetasheet = "#"

Expand Down
1 change: 1 addition & 0 deletions internal/protogen/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func prepareOutdir(outdir string, importFiles []string, delExisted bool) error {
return nil
}

// getWorkbookAlias gets the workbook alias from importer.
func getWorkbookAlias(imp importer.Importer) string {
sheetMap := imp.Metabook().GetMetasheetMap()
if sheetMap == nil {
Expand Down
22 changes: 22 additions & 0 deletions test/functest/conf/HorizontalIncellInStructList.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"taskList": [
{
"paramList": [
1
]
},
{
"paramList": [
2,
3
]
},
{
"paramList": [
4,
5,
6
]
}
]
}
9 changes: 9 additions & 0 deletions test/functest/proto/excel__list__horizontal_list.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ message HorizontalEnumList {
repeated protoconf.FruitType param_list = 1 [(tableau.field) = {name:"Param" layout:LAYOUT_HORIZONTAL}];
}

message HorizontalIncellInStructList {
option (tableau.worksheet) = {name:"HorizontalIncellInStructList" namerow:1 typerow:2 noterow:3 datarow:4};

repeated Task task_list = 1 [(tableau.field) = {name:"Task" layout:LAYOUT_HORIZONTAL}];
message Task {
repeated int32 param_list = 1 [(tableau.field) = {name:"Param" layout:LAYOUT_INCELL}];
}
}

message HorizontalIncellPdefStructList {
option (tableau.worksheet) = {name:"HorizontalIncellPdefStructList" namerow:1 typerow:2 noterow:3 datarow:4};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Task1Param,Task2Param,Task3Param
[Task][]int32,[]int32,[]int32
Task1,Task2,Task3
1,"2,3","4,5,6"

0 comments on commit abc638b

Please sign in to comment.