Collapsed repetitive code into generic functions.

Establishing patterns for individual objects, discovering designs to collapse what would be an obscene amount of repetitive code.
This commit is contained in:
Dave Shanley
2022-09-30 10:39:35 -04:00
parent cb7df7c9b2
commit ba37ca4e29
8 changed files with 390 additions and 126 deletions

View File

@@ -175,7 +175,6 @@ x-testing: hello`
_ = lDoc.Build(lNode.Content[0], nil)
_ = rDoc.Build(rNode.Content[0], nil)
// compare.
// compare.
extChanges := CompareExternalDocs(&lDoc, &rDoc)
assert.Equal(t, 2, extChanges.TotalChanges())
@@ -201,7 +200,6 @@ url: https://pb33f.io`
_ = lDoc.Build(lNode.Content[0], nil)
_ = rDoc.Build(rNode.Content[0], nil)
// compare.
// compare.
extChanges := CompareExternalDocs(&lDoc, &rDoc)
assert.Equal(t, 1, extChanges.TotalChanges())
@@ -227,7 +225,6 @@ description: something`
_ = lDoc.Build(lNode.Content[0], nil)
_ = rDoc.Build(rNode.Content[0], nil)
// compare.
// compare.
extChanges := CompareExternalDocs(&lDoc, &rDoc)
assert.Equal(t, 1, extChanges.TotalChanges())
@@ -236,8 +233,8 @@ description: something`
func TestCompareExternalDocs_URLRemoved(t *testing.T) {
left := `url: https://pb33f.io
description: something`
left := `description: something
url: https://pb33f.io`
right := `description: something`
@@ -253,8 +250,7 @@ description: something`
_ = lDoc.Build(lNode.Content[0], nil)
_ = rDoc.Build(rNode.Content[0], nil)
// compare.
// compare.
// compare
extChanges := CompareExternalDocs(&lDoc, &rDoc)
assert.Equal(t, 1, extChanges.TotalChanges())
assert.Equal(t, PropertyRemoved, extChanges.Changes[0].ChangeType)