Skip to content

Commit

Permalink
add auto-generated warning in generated docs; update unit test (#140)
Browse files Browse the repository at this point in the history
* add auto-generated warning in generated docs; update unit test

* update test result

* update test result on windows
  • Loading branch information
amyXia1994 authored Aug 21, 2023
1 parent 55c6ba1 commit 8fb20d7
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pkg/tools/gen/gendoc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ name of the person
## Source Files
- [models.Person](models/person.k)
<!-- Auto generated by kcl-doc tool, please do not edit. -->
`,
expectWindows: `## Schema Person
Expand All @@ -72,6 +74,8 @@ name of the person
## Source Files
- [models.Person](models\person.k)
<!-- Auto generated by kcl-doc tool, please do not edit. -->
`,
},
}
Expand Down Expand Up @@ -202,6 +206,9 @@ func CompareDir(a string, b string) error {
)
}
}
if len(linesA) < len(linesB) {
return fmt.Errorf("file content different, contains more lines in file %s:%v - %v:\n%s", aPath, len(linesA), len(linesB), strings.Join(linesB[len(linesA):], "\n"))
}
}
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/tools/gen/templates/doc/packageDoc.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
{{range $index, $schema := sortSchemas .Schemas}}- [{{$schema.KclExtensions.XKclModelType.Type}}]({{$schema.KclExtensions.XKclModelType.Type}}.md)

{{end -}}

{{- end}}
<!-- Auto generated by kcl-doc tool, please do not edit. -->
{{end}}
2 changes: 2 additions & 0 deletions pkg/tools/gen/templates/doc/schemaDoc.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
## Source Files

- [{{fullTypeName . }}]({{sourcePath .}})

<!-- Auto generated by kcl-doc tool, please do not edit. -->
{{end}}
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/pkg/unixlike/md/Container.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ The name of the long-running container.
## Source Files

- [Container](container.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/pkg/unixlike/md/Server.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ See also: kusion_models/core/v1/workload_metadata.k.
## Source Files

- [Server](server.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/pkg/unixlike/md/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

- [Server](Server.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/pkg/unixlike/md/k8s/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [k8s.Deployment](k8s/deployment.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/pkg/unixlike/md/k8s/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [Deployment](Deployment.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/pkg/windows/md/Container.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ The name of the long-running container.
## Source Files

- [Container](container.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/pkg/windows/md/Server.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ See also: kusion_models/core/v1/workload_metadata.k.
## Source Files

- [Server](server.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/pkg/windows/md/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

- [Server](Server.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/pkg/windows/md/k8s/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [k8s.Deployment](k8s\deployment.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/pkg/windows/md/k8s/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [Deployment](Deployment.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/reimport/unixlike/md/A.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [A](a.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/reimport/unixlike/md/B.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [B](b.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/reimport/unixlike/md/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

- [B](B.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [k8s.Deployment](k8s/deployment.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [Deployment](Deployment.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/reimport/windows/md/A.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [A](a.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
2 changes: 2 additions & 0 deletions pkg/tools/gen/testdata/doc/reimport/windows/md/B.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [B](b.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
1 change: 1 addition & 0 deletions pkg/tools/gen/testdata/doc/reimport/windows/md/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

- [B](B.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
## Source Files

- [k8s.Deployment](k8s\deployment.k)

<!-- Auto generated by kcl-doc tool, please do not edit. -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [Deployment](Deployment.md)

<!-- Auto generated by kcl-doc tool, please do not edit. -->

0 comments on commit 8fb20d7

Please sign in to comment.