| 🛟 Updated. 28d5985 k33g 18h ago | 1 | package app |
| 2 | |
| 📦 Turbo Core f3ade8d k33g 10h ago | 3 | import "rickub.com/turbo-editors/turbo-core/profile" |
| 🛟 Updated. 28d5985 k33g 18h ago | 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. |
| 14 | func 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. |
| 36 | const testSettingsTemplate = `# turbo-test project settings. |
| 37 | # |
| 38 | # Delete this file and the editor falls back to its own defaults. |
| 39 | |
| 40 | [editor] |
| 41 | |
| 42 | theme = %q |
| 43 | autosave = false |
| 44 | autosave_delay = %q |
| 45 | ` |
| 46 | |
| 47 | // testSnippetsTemplate takes the ungrouped group's name and the user's own |
| 48 | // snippets path, in that order. |
| 49 | const testSnippetsTemplate = `# turbo-test snippets. |
| 50 | # |
| 51 | # A snippet with no group goes into %s. |
| 52 | # Your own live in: |
| 53 | # %s |
| 54 | |
| 55 | [[snippet]] |
| 56 | name = "note" |
| 57 | body = "NOTE: " |
| 58 | ` |
| 59 | |
| 60 | const testToolsTemplate = `# turbo-test tools. |
| 61 | |
| 62 | [[tool]] |
| 63 | name = "~B~uild" |
| 64 | command = "true" |
| 65 | output = "popup" |
| 66 | ` |
| 67 | |
| 68 | // testAgentsTemplate takes the editor's own project directory and the user's |
| 69 | // own agents path, in that order. |
| 70 | const 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]] |
| 77 | name = "Echo agent" |
| 78 | command = "cat" |
| 79 | ` |