| 392 | } |
| 393 | |
| 394 | func TestBindStructs(t *testing.T) { |
| 395 | // t.Parallel() |
| 396 | path := "_examples/structs" |
| 397 | testPkg(t, pkg{ |
| 398 | path: path, |
| 399 | lang: features[path], |
| 400 | cmd: "build", |
| 401 | extras: nil, |
| 402 | want: []byte(`s = structs.S() |
| 403 | s = structs.S{handle=1} |
| 404 | s.Init() |
| 405 | s.Upper('boo')= 'BOO' |
| 406 | s1 = structs.S1() |
| 407 | s1 = structs.S1{handle=2} |
| 408 | caught error: 'S1' object has no attribute 'private' |
| 409 | s2 = structs.S2() |
| 410 | s2 = structs.S2{Public=1, handle=5} |
| 411 | s2 = structs.S2{Public=42, handle=7} |
| 412 | s2.Public = 42 |
| 413 | caught error: 'S2' object has no attribute 'private' |
| 414 | s2child = S2Child{S2: structs.S2{Public=42, handle=8, local=123}, local: 123} |
| 415 | s2child.Public = 42 |
| 416 | s2child.local = 123 |
| 417 | caught error: 'S2Child' object has no attribute 'private' |
| 418 | s3.X,Y = 3,4 |
| 419 | OK |
| 420 | `), |
| 421 | }) |
| 422 | } |
| 423 | |
| 424 | func TestBindConsts(t *testing.T) { |
| 425 | // t.Parallel() |