turbo-editors/turbo-corepublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-core.git
git clone ssh://git@rickub.com/turbo-editors/turbo-core.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

testprofile_test.go · 79 lines · 2.0 KBGo Blame HistoryRaw
🛟 Updated. 28d5985 k33g 5h ago1package app
2
3import "codeberg.org/turbo-editors/turbo-core/profile"
4
5// testProfile is the fictional editor the tests in this package drive.
6//
7// It is deliberately not Turbo Go: this package assembles *an* editor, and a
8// test that expected the Go menu, gopls or .turbo-go would be testing Turbo Go's
9// choices from inside the library those choices are made outside of. The
10// templates below are small but real, because the code under test writes them
11// out and reads them back.
12//
13// "Test" takes T as its hot key, which none of the fixed menus claims.
14func testProfile() profile.Profile {
15 return profile.Profile{
16 Name: "Turbo Test",
17 Slug: "turbo-test",
18 Language: "Test",
19 ToolsMenu: "~T~est",
20 RootMarkers: []string{"test.mod"},
21 Server: profile.Server{
22 Command: "test-analyzer",
23 InstallHint: "install test-analyzer",
24 },
25 Templates: profile.Templates{
26 Settings: testSettingsTemplate,
27 Snippets: testSnippetsTemplate,
28 Tools: testToolsTemplate,
29 Agents: testAgentsTemplate,
30 },
31 }
32}
33
34// testSettingsTemplate takes the theme name and the autosave delay, in that
35// order, as profile.Templates says it must.
36const testSettingsTemplate = `# turbo-test project settings.
37#
38# Delete this file and the editor falls back to its own defaults.
39
40[editor]
41
42theme = %q
43autosave = false
44autosave_delay = %q
45`
46
47// testSnippetsTemplate takes the ungrouped group's name and the user's own
48// snippets path, in that order.
49const testSnippetsTemplate = `# turbo-test snippets.
50#
51# A snippet with no group goes into %s.
52# Your own live in:
53# %s
54
55[[snippet]]
56name = "note"
57body = "NOTE: "
58`
59
60const testToolsTemplate = `# turbo-test tools.
61
62[[tool]]
63name = "~B~uild"
64command = "true"
65output = "popup"
66`
67
68// testAgentsTemplate takes the editor's own project directory and the user's
69// own agents path, in that order.
70const testAgentsTemplate = `# turbo-test agents.
71#
72# The agent's own configuration lives in %[1]s.
73# Your own agents live in:
74# %[2]s
75
76[[agent]]
77name = "Echo agent"
78command = "cat"
79`