diff options
author | clsr <clsr@clsr.net> | 2017-08-25 15:04:40 +0200 |
---|---|---|
committer | clsr <clsr@clsr.net> | 2017-08-25 15:04:40 +0200 |
commit | 4c0470d24b00445b67a5a0accde8538d8c810730 (patch) | |
tree | 3f7ad0838d9883e31fa00d54f176bb81ca50a7d4 /write_test.go | |
parent | 0cf5f7a9b1fcb272cd9d632bc76219edd7077c39 (diff) | |
download | cnm-go-4c0470d24b00445b67a5a0accde8538d8c810730.tar.gz cnm-go-4c0470d24b00445b67a5a0accde8538d8c810730.zip |
Make TableBlock extend ContentBlock; add AppendChild to ContainerBlock
Diffstat (limited to 'write_test.go')
-rw-r--r-- | write_test.go | 150 |
1 files changed, 77 insertions, 73 deletions
diff --git a/write_test.go b/write_test.go index bf829a0..18809b1 100644 --- a/write_test.go +++ b/write_test.go @@ -108,79 +108,83 @@ content name: "section", args: []string{"of the"}, children: []Block{ - &TableBlock{[]Block{ - &HeaderBlock{ContentBlock{ - name: "header", - args: []string{}, - children: []Block{ - &TextBlock{ - Contents: TextPlainContents{[]string{ - "Column 1", - }}, - }, - &TextBlock{ - Contents: TextPlainContents{[]string{ - "Column 2", - }}, + &TableBlock{ContentBlock{ + name: "table", + args: nil, + children: []Block{ + &HeaderBlock{ContentBlock{ + name: "header", + args: []string{}, + children: []Block{ + &TextBlock{ + Contents: TextPlainContents{[]string{ + "Column 1", + }}, + }, + &TextBlock{ + Contents: TextPlainContents{[]string{ + "Column 2", + }}, + }, }, - }, - }}, - &RowBlock{ContentBlock{ - name: "row", - args: []string{}, - children: []Block{ - &TextBlock{ - Contents: TextPlainContents{[]string{ - "CNM", - }}, + }}, + &RowBlock{ContentBlock{ + name: "row", + args: []string{}, + children: []Block{ + &TextBlock{ + Contents: TextPlainContents{[]string{ + "CNM", + }}, + }, + &TextBlock{ + Contents: TextPlainContents{[]string{ + "document", + "format", + }}, + }, }, - &TextBlock{ - Contents: TextPlainContents{[]string{ - "document", - "format", + }}, + &RowBlock{ContentBlock{ + name: "row", + args: []string{""}, + children: []Block{ + &SectionBlock{ContentBlock{ + name: "section", + args: []string{"", "", ""}, }}, - }, - }, - }}, - &RowBlock{ContentBlock{ - name: "row", - args: []string{""}, - children: []Block{ - &SectionBlock{ContentBlock{ - name: "section", - args: []string{"", "", ""}, - }}, - &ListBlock{ContentBlock{ - name: "list", - args: nil, - children: []Block{ - &TextBlock{ - Contents: TextPlainContents{[]string{ - "ipsum", - }}, - }, - &ListBlock{ContentBlock{ - name: "list", - args: []string{"ordered"}, - children: []Block{ - &ListBlock{ContentBlock{ - name: "list", - args: []string{"unordered"}, - children: []Block{ - &TextBlock{ - Contents: TextPlainContents{[]string{ - "dolor", - "sit amet", - }}, - }, - }, + &ListBlock{ContentBlock{ + name: "list", + args: nil, + children: []Block{ + &TextBlock{ + Contents: TextPlainContents{[]string{ + "ipsum", }}, }, - }}, - }, - }}, - }, - }}, + &ListBlock{ContentBlock{ + name: "list", + args: []string{"ordered"}, + children: []Block{ + &ListBlock{ContentBlock{ + name: "list", + args: []string{"unordered"}, + children: []Block{ + &TextBlock{ + Contents: TextPlainContents{[]string{ + "dolor", + "sit amet", + }}, + }, + }, + }}, + }, + }}, + }, + }}, + }, + }}, + }, }}, }, }}, @@ -205,12 +209,12 @@ func TestWrite(t *testing.T) { t.Fatalf("Write error: %v", err) } w := buf.String() - t.Log("====================") - t.Log("expected:\n" + k) - t.Log("--------------------") - t.Log(" got:\n" + w) - t.Log("====================") if k != w { + t.Log("====================") + t.Log("expected:\n" + k) + t.Log("--------------------") + t.Log(" got:\n" + w) + t.Log("====================") t.Fatal("Write: output did not match expected document") } }) |