Skip to content

Commit

Permalink
add test case for format package
Browse files Browse the repository at this point in the history
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
  • Loading branch information
ashutosh-narkar committed Mar 7, 2024
1 parent 4991638 commit 4d58403
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions format/format_test.go
Expand Up @@ -516,6 +516,53 @@ a[_x[y][[z, w]]]`,
}(),
expected: `concat(",", [__local1__], __local0__)`,
},
{
note: "module with annotations",
toFmt: func() *ast.Module {
raw := `# METADATA
# title: pkg
# description: pkg
# scope: subpackages
# some random comment
package test
# METADATA
# title: p
# description: p
p := 1
# METADATA
# title: q
# description: q
# scope: rule
# another random comment
q := 1`

return ast.MustParseModuleWithOpts(raw, ast.ParserOptions{ProcessAnnotation: true})
}(),
expected: `# METADATA
# title: pkg
# description: pkg
# scope: subpackages
# some random comment
package test
# METADATA
# title: p
# description: p
p := 1
# METADATA
# title: q
# description: q
# scope: rule
# another random comment
q := 1`,
},
}

for _, tc := range cases {
Expand Down

0 comments on commit 4d58403

Please sign in to comment.