summaryrefslogtreecommitdiffstats
path: root/parser/frontmatter_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-02-12 17:32:42 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-02-12 18:17:25 +0100
commitd4beef0d2bb8f6481fa80e1d938454a7d4e38814 (patch)
tree8838d2bb578ce0b4fad89ba249a7220be340e546 /parser/frontmatter_test.go
parent51213e0be19fc19dbca9815afa95c73bd6d159c2 (diff)
parser: Rename stringifyYAMLMapKeys to stringifyMapKeys
Diffstat (limited to 'parser/frontmatter_test.go')
-rw-r--r--parser/frontmatter_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/parser/frontmatter_test.go b/parser/frontmatter_test.go
index 9ac974951..4d28facb2 100644
--- a/parser/frontmatter_test.go
+++ b/parser/frontmatter_test.go
@@ -353,7 +353,7 @@ func TestStringifyYAMLMapKeys(t *testing.T) {
}
for i, c := range cases {
- res := stringifyYAMLMapKeys(c.input)
+ res := stringifyMapKeys(c.input)
if !reflect.DeepEqual(res, c.want) {
t.Errorf("[%d] given %q\nwant: %q\n got: %q", i, c.input, c.want, res)
}
@@ -387,7 +387,7 @@ func BenchmarkStringifyMapKeysStringsOnlyInterfaceMaps(b *testing.B) {
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
- stringifyYAMLMapKeys(maps[i])
+ stringifyMapKeys(maps[i])
}
}
@@ -429,7 +429,7 @@ func BenchmarkStringifyMapKeysIntegers(b *testing.B) {
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
- stringifyYAMLMapKeys(maps[i])
+ stringifyMapKeys(maps[i])
}
}
func doBenchmarkFrontmatter(b *testing.B, fileformat string, numTags int) {
/span>== "rebasing" { options = append(options, "skip") } menuItems := make([]*menuItem, len(options)) for i, option := range options { // note to self. Never, EVER, close over loop variables in a function option := option menuItems[i] = &menuItem{ displayString: option, onPress: func() error { return gui.genericMergeCommand(option) }, } } var title string if gui.GitCommand.WorkingTreeState() == "merging" { title = gui.Tr.SLocalize("MergeOptionsTitle") } else { title = gui.Tr.SLocalize("RebaseOptionsTitle") } return gui.createMenu(title, menuItems, createMenuOptions{showCancel: true}) } func (gui *Gui) genericMergeCommand(command string) error { status := gui.GitCommand.WorkingTreeState() if status != "merging" && status != "rebasing" { return gui.createErrorPanel(gui.Tr.SLocalize("NotMergingOrRebasing")) } commandType := strings.Replace(status, "ing", "e", 1) // we should end up with a command like 'git merge --continue' // it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge if status == "merging" && command != "abort" && gui.Config.GetUserConfig().GetBool("git.merging.manualCommit") { sub := gui.OSCommand.PrepareSubProcess("git", commandType, fmt.Sprintf("--%s", command)) if sub != nil { gui.SubProcess = sub return gui.Errors.ErrSubProcess } return nil } result := gui.GitCommand.GenericMerge(commandType, command) if err := gui.handleGenericMergeCommandResult(result); err != nil { return err } return nil } func (gui *Gui) handleGenericMergeCommandResult(result error) error { if err := gui.refreshSidePanels(refreshOptions{mode: ASYNC}); err != nil { return err } if result == nil { return nil } else if result == gui.Errors.ErrSubProcess { return result } else if strings.Contains(result.Error(), "No changes - did you forget to use") { return gui.genericMergeCommand("skip") } else if strings.Contains(result.Error(), "The previous cherry-pick is now empty") { return gui.genericMergeCommand("continue") } else if strings.Contains(result.Error(), "No rebase in progress?") { // assume in this case that we're already done return nil } else if strings.Contains(result.Error(), "When you have resolved this problem") || strings.Contains(result.Error(), "fix conflicts") || strings.Contains(result.Error(), "Resolve all conflicts manually") { return gui.ask(askOpts{ title: gui.Tr.SLocalize("FoundConflictsTitle"), prompt: gui.Tr.SLocalize("FoundConflicts"), handleConfirm: func() error { return nil }, handleClose: func() error { return gui.genericMergeCommand("abort") }, }) } else { return gui.createErrorPanel(result.Error()) } }