TestEngineVersionNotProvided tests that when no version is provided, the Version field remains empty (default behavior).
(t *testing.T)
| 134 | // TestEngineVersionNotProvided tests that when no version is provided, |
| 135 | // the Version field remains empty (default behavior). |
| 136 | func TestEngineVersionNotProvided(t *testing.T) { |
| 137 | tests := []struct { |
| 138 | name string |
| 139 | frontmatter map[string]any |
| 140 | }{ |
| 141 | { |
| 142 | name: "engine without version field", |
| 143 | frontmatter: map[string]any{ |
| 144 | "engine": map[string]any{ |
| 145 | "id": "copilot", |
| 146 | }, |
| 147 | }, |
| 148 | }, |
| 149 | { |
| 150 | name: "engine as string (backward compatibility)", |
| 151 | frontmatter: map[string]any{ |
| 152 | "engine": "copilot", |
| 153 | }, |
| 154 | }, |
| 155 | } |
| 156 | |
| 157 | compiler := NewCompiler() |
| 158 | |
| 159 | for _, tt := range tests { |
| 160 | t.Run(tt.name, func(t *testing.T) { |
| 161 | _, config := compiler.ExtractEngineConfig(tt.frontmatter) |
| 162 | |
| 163 | if config == nil { |
| 164 | t.Fatal("Expected config to be non-nil") |
| 165 | } |
| 166 | |
| 167 | if config.Version != "" { |
| 168 | t.Errorf("Expected empty version, got %q", config.Version) |
| 169 | } |
| 170 | }) |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | // TestEngineVersionWithOtherFields tests that version works correctly |
| 175 | // alongside other engine configuration fields. |
nothing calls this directly
no test coverage detected