| 219 | } |
| 220 | |
| 221 | func TestContainers_Extend_Name(t *testing.T) { |
| 222 | c, err := DefaultContainer.Extend(Name("")) |
| 223 | if err != nil { |
| 224 | t.Fatal(err) |
| 225 | } |
| 226 | if c.Name() != "" { |
| 227 | t.Errorf("got %v, wanted empty name", c.Name()) |
| 228 | } |
| 229 | c, err = DefaultContainer.Extend(Name("hello.container")) |
| 230 | if err != nil { |
| 231 | t.Fatal(err) |
| 232 | } |
| 233 | if c.Name() != "hello.container" { |
| 234 | t.Errorf("got container name %s, wanted 'hello.container'", c.Name()) |
| 235 | } |
| 236 | c, err = c.Extend(Name("goodbye.container")) |
| 237 | if err != nil { |
| 238 | t.Fatal(err) |
| 239 | } |
| 240 | if c.Name() != "goodbye.container" { |
| 241 | t.Errorf("got container name %s, wanted 'goodbye.container'", c.Name()) |
| 242 | } |
| 243 | c, err = c.Extend(Name(".bad.container")) |
| 244 | if err == nil { |
| 245 | t.Errorf("got %v, wanted error", c.Name()) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | func TestContainers_ToQualifiedName(t *testing.T) { |
| 250 | fac := ast.NewExprFactory() |