OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 //! Tests encoding and decoding functionality in the bindings package | 5 //! Tests encoding and decoding functionality in the bindings package |
6 //! | 6 //! |
7 //! Test failure is defined as the function returning via panicking | 7 //! Test failure is defined as the function returning via panicking |
8 //! and the result being caught in the test! macro. If a test function | 8 //! and the result being caught in the test! macro. If a test function |
9 //! returns without panicking, it is assumed to pass. | 9 //! returns without panicking, it is assumed to pass. |
10 | 10 |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 assert!(payload.param0.d.is_none()); | 665 assert!(payload.param0.d.is_none()); |
666 assert!(payload.param0.e.is_none()); | 666 assert!(payload.param0.e.is_none()); |
667 let union_val = payload.param0.c.as_ref().unwrap(); | 667 let union_val = payload.param0.c.as_ref().unwrap(); |
668 match *union_val { | 668 match *union_val { |
669 UnionA::b(ref val) => assert_eq!(*val, 54), | 669 UnionA::b(ref val) => assert_eq!(*val, 54), |
670 _ => panic!("Incorrect union variant! Tag found: {}", union_
val.get_tag()), | 670 _ => panic!("Incorrect union variant! Tag found: {}", union_
val.get_tag()), |
671 } | 671 } |
672 } | 672 } |
673 } | 673 } |
674 } | 674 } |
| 675 integration_intf_rqst_mthd0_good { |
| 676 MessageHeader => { |
| 677 |header: MessageHeader| { |
| 678 assert_eq!(header.version, 1); |
| 679 assert_eq!(header.name, 0); |
| 680 assert_eq!(header.flags, 1); |
| 681 assert_eq!(header.request_id, 7); |
| 682 } |
| 683 }, |
| 684 IntegrationTestInterfaceMethod0Request => { |
| 685 |payload: &IntegrationTestInterfaceMethod0Request| { |
| 686 assert_eq!(payload.param0.a, -1); |
| 687 } |
| 688 } |
| 689 } |
| 690 integration_intf_resp_mthd0_good { |
| 691 MessageHeader => { |
| 692 |header: MessageHeader| { |
| 693 assert_eq!(header.version, 1); |
| 694 assert_eq!(header.name, 0); |
| 695 assert_eq!(header.flags, 2); |
| 696 assert_eq!(header.request_id, 1); |
| 697 } |
| 698 }, |
| 699 IntegrationTestInterfaceMethod0Response => { |
| 700 |payload: &IntegrationTestInterfaceMethod0Response| { |
| 701 assert_eq!(payload.param0, vec![0]); |
| 702 } |
| 703 } |
| 704 } |
675 } | 705 } |
OLD | NEW |