|
6 | 6 |
|
7 | 7 | _ "github.com/donislawdev/TestingFilesGenerator/internal/format/all" |
8 | 8 | "github.com/donislawdev/TestingFilesGenerator/internal/gui/text" |
| 9 | + "github.com/donislawdev/TestingFilesGenerator/internal/recipe" |
9 | 10 | ) |
10 | 11 |
|
11 | 12 | // The screen that says what this program is also says what to do with it. |
@@ -63,3 +64,35 @@ func TestTheAboutScreenSaysHowToUseTheProgram(t *testing.T) { |
63 | 64 | t.Errorf("the About screen no longer says what this program is:\n%s", said) |
64 | 65 | } |
65 | 66 | } |
| 67 | + |
| 68 | +// TestTheStepsNameEveryOutcomeTheManifestCanRecord. |
| 69 | +// |
| 70 | +// The third step tells somebody what they will find in the manifest, which |
| 71 | +// makes it a list copied out of a closed set - and a list copied by hand that |
| 72 | +// nothing compares with its source goes stale on green. The set is |
| 73 | +// recipe.Outcomes(), four values today, and the first version of that step |
| 74 | +// named two of them, invented a third word for one ("turn it away" for |
| 75 | +// reject) and left sanitize out altogether. Nothing in the tree would have |
| 76 | +// said so. |
| 77 | +// |
| 78 | +// Read from the REGISTRY rather than from a list here, so a fifth outcome is |
| 79 | +// caught by being declared. That is the whole reason this is a guard and not |
| 80 | +// a proofread. |
| 81 | +func TestTheStepsNameEveryOutcomeTheManifestCanRecord(t *testing.T) { |
| 82 | + content, _ := laidOutWindow(t) |
| 83 | + about := tabContent(t, content, text.TabAbout()) |
| 84 | + said := shownText(about) |
| 85 | + |
| 86 | + outcomes := recipe.Outcomes() |
| 87 | + if len(outcomes) < 2 { |
| 88 | + t.Fatalf("the recipe package declares %d outcome(s), which is too few for this to compare anything", len(outcomes)) |
| 89 | + } |
| 90 | + for _, outcome := range outcomes { |
| 91 | + if !strings.Contains(said, outcome) { |
| 92 | + t.Errorf("the manifest can record outcome %q and the About screen never uses that word, "+ |
| 93 | + "so somebody reading the steps meets it for the first time in the JSON.\nThe screen says:\n%s", |
| 94 | + outcome, said) |
| 95 | + } |
| 96 | + } |
| 97 | + t.Logf("%d outcome(s) named on the screen: %v", len(outcomes), outcomes) |
| 98 | +} |
0 commit comments