Skip to content

Commit

Permalink
chore(test): cleanup code (#881)
Browse files Browse the repository at this point in the history
make `test.adoc` the default file name in tests
also, remove commented out lines

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored Dec 20, 2021
1 parent 501b3d5 commit 551975a
Show file tree
Hide file tree
Showing 26 changed files with 7,659 additions and 7,914 deletions.
2 changes: 1 addition & 1 deletion libasciidoc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ a paragraph with _italic content_`
</div>
</div>
`
Expect(RenderHTML(source, configuration.WithFilename("test.adoc"))).To(Equal(expected))
Expect(RenderHTML(source)).To(Equal(expected))
Expect(DocumentMetadata(source, lastUpdated)).To(Equal(types.Metadata{
Title: "",
LastUpdated: lastUpdated.Format(configuration.LastUpdatedFormat),
Expand Down
6 changes: 0 additions & 6 deletions pkg/parser/attribute_substitution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ var _ = Describe("attribute substitutions", func() {
a paragraph written by {author}.`
expected := &types.Document{
// Attributes: types.Attributes{
// "author": "Xavier",
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "author",
Expand All @@ -44,9 +41,6 @@ a paragraph written by {author}.`
:author2!:
a paragraph written by {author}.`
expected := &types.Document{
// Attributes: types.Attributes{
// "author": "Xavier",
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "author",
Expand Down
18 changes: 0 additions & 18 deletions pkg/parser/check_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ var _ = Describe("checked lists", func() {
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
// Attributes: types.Attributes{
// types.AttrCheckStyle: types.NoCheck,
// },
Elements: []interface{}{
&types.StringElement{
Content: "normal list item",
Expand Down Expand Up @@ -166,9 +163,6 @@ var _ = Describe("checked lists", func() {
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
// Attributes: types.Attributes{
// types.AttrCheckStyle: types.NoCheck,
// },
Elements: []interface{}{
&types.StringElement{
Content: "normal list item",
Expand Down Expand Up @@ -273,9 +267,6 @@ var _ = Describe("checked lists", func() {
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
// Attributes: types.Attributes{
// types.AttrCheckStyle: types.NoCheck,
// },
Elements: []interface{}{
&types.StringElement{
Content: "normal list item",
Expand Down Expand Up @@ -327,9 +318,6 @@ var _ = Describe("checked lists", func() {
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
// Attributes: types.Attributes{
// types.AttrCheckStyle: types.NoCheck,
// },
Elements: []interface{}{
&types.StringElement{
Content: "a normal list item",
Expand All @@ -343,9 +331,6 @@ var _ = Describe("checked lists", func() {
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
// Attributes: types.Attributes{
// types.AttrCheckStyle: types.NoCheck,
// },
Elements: []interface{}{
&types.StringElement{
Content: "another normal list item",
Expand All @@ -363,9 +348,6 @@ var _ = Describe("checked lists", func() {
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
// Attributes: types.Attributes{
// types.AttrCheckStyle: types.NoCheck,
// },
Elements: []interface{}{
&types.StringElement{
Content: "normal list item",
Expand Down
3 changes: 0 additions & 3 deletions pkg/parser/cross_reference_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,6 @@ some content`
some content linked to xref:{foo}[another_doc()]!`
expected := &types.Document{
// Attributes: types.Attributes{
// "foo": "another-doc.adoc",
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "foo",
Expand Down
36 changes: 0 additions & 36 deletions pkg/parser/delimited_block_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ and <more text> on the +
It("should apply the default substitution", func() {
s := strings.ReplaceAll(source, "[subs=\"$SUBS\"]\n", "")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -295,9 +292,6 @@ and <more text> on the +
It("should apply the 'normal' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "normal")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -388,9 +382,6 @@ and <more text> on the +
It("should apply the 'quotes' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "quotes")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -430,9 +421,6 @@ and <more text> on the +
It("should apply the 'macros' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "macros")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -474,9 +462,6 @@ and <more text> on the +
It("should apply the 'attributes' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "attributes")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -505,9 +490,6 @@ and <more text> on the +
It("should apply the 'attributes,macros' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "attributes,macros")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -559,9 +541,6 @@ and <more text> on the +
It("should apply the 'specialchars' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "specialchars")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -614,9 +593,6 @@ and <more text> on the +
It("should apply the 'replacements' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "replacements")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -645,9 +621,6 @@ and <more text> on the +
It("should apply the 'post_replacements' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "post_replacements")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -680,9 +653,6 @@ and <more text> on the +
It("should apply the 'quotes,macros' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "quotes,macros")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -735,9 +705,6 @@ and <more text> on the +
It("should apply the 'macros,quotes' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "macros,quotes")
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down Expand Up @@ -790,9 +757,6 @@ and <more text> on the +
It("should apply the 'none' substitution", func() {
s := strings.ReplaceAll(source, "$SUBS", "none") // the `none` substitution applies to the *content of the elements* with the example block
expected := &types.Document{
// Attributes: types.Attributes{
// "github-url": "https://github.com",
//},
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "github-url",
Expand Down
6 changes: 0 additions & 6 deletions pkg/parser/document_fragment_processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ var _ = Describe("document processing", func() {
foo
----`
expected := &types.Document{
// Attributes: types.Attributes{
// types.AttrSyntaxHighlighter: "pygments",
// },
Elements: []interface{}{
&types.DelimitedBlock{
Kind: types.Listing,
Expand Down Expand Up @@ -75,9 +72,6 @@ Preamble comes here
},
}
expected := &types.Document{
// Attributes: types.Attributes{
// types.AttrTableOfContents: nil,
// },
Elements: []interface{}{
&types.DocumentHeader{
Title: []interface{}{
Expand Down
22 changes: 0 additions & 22 deletions pkg/parser/document_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,12 +1038,6 @@ v1.0:`
:hardbreaks:
a paragraph`
expected := &types.Document{
// Attributes: types.Attributes{
// "toc": nil,
// "date": "2017-01-01",
// "author": "Xavier",
// types.DocumentAttrHardBreaks: nil,
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "toc",
Expand Down Expand Up @@ -1079,11 +1073,6 @@ a paragraph`
a paragraph`
expected := &types.Document{
// Attributes: types.Attributes{
// "toc": nil,
// "date": "2017-01-01",
// "author": "Xavier",
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "toc",
Expand Down Expand Up @@ -1117,12 +1106,6 @@ a paragraph`
a paragraph`
expected := &types.Document{
// Attributes: types.Attributes{
// "toc": nil,
// "date": "2017-01-01",
// "author": "Xavier",
// "hardbreaks": nil,
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: "toc",
Expand Down Expand Up @@ -1156,11 +1139,6 @@ a paragraph`
:date: 2017-01-01
:author: Xavier`
expected := &types.Document{
// Attributes: types.Attributes{
// "toc": nil,
// "date": "2017-01-01",
// "author": "Xavier",
// },
Elements: []interface{}{
&types.Paragraph{
Elements: []interface{}{
Expand Down
3 changes: 0 additions & 3 deletions pkg/parser/document_processing_aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ var _ = Describe("include preamble and table of contents when aggregating fragme
}
close(c)
expected := &types.Document{
// Attributes: types.Attributes{
// types.AttrTableOfContents: nil,
// },
Elements: []interface{}{
&types.AttributeDeclaration{
Name: types.AttrTableOfContents,
Expand Down
Loading

0 comments on commit 551975a

Please sign in to comment.