OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/convert/chunked_conversion2_test', null, /* Imports */
[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__chunked_conversion2_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const convert = dart_sdk.convert; |
| 8 const _interceptors = dart_sdk._interceptors; |
| 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; |
| 11 const expect$ = expect.expect; |
| 12 const chunked_conversion2_test = Object.create(null); |
| 13 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 14 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 15 chunked_conversion2_test.MyByteSink = class MyByteSink extends convert.ByteCon
versionSinkBase { |
| 16 new() { |
| 17 this.accumulator = []; |
| 18 } |
| 19 add(bytes) { |
| 20 this.accumulator[dartx.add](bytes); |
| 21 } |
| 22 close() {} |
| 23 }; |
| 24 dart.setSignature(chunked_conversion2_test.MyByteSink, { |
| 25 methods: () => ({ |
| 26 add: dart.definiteFunctionType(dart.void, [core.List$(core.int)]), |
| 27 close: dart.definiteFunctionType(dart.void, []) |
| 28 }) |
| 29 }); |
| 30 chunked_conversion2_test.testBase = function() { |
| 31 let byteSink = new chunked_conversion2_test.MyByteSink(); |
| 32 let bytes = JSArrayOfint().of([1]); |
| 33 byteSink.addSlice(bytes, 0, 1, false); |
| 34 bytes[dartx.set](0, 2); |
| 35 byteSink.addSlice(bytes, 0, 1, true); |
| 36 expect$.Expect.equals(1, dart.dindex(byteSink.accumulator[dartx.get](0), 0))
; |
| 37 expect$.Expect.equals(2, dart.dindex(byteSink.accumulator[dartx.get](1), 0))
; |
| 38 }; |
| 39 dart.fn(chunked_conversion2_test.testBase, VoidTovoid()); |
| 40 chunked_conversion2_test.MyChunkedSink = class MyChunkedSink extends convert.C
hunkedConversionSink$(core.List$(core.int)) { |
| 41 new() { |
| 42 this.accumulator = []; |
| 43 super.new(); |
| 44 } |
| 45 add(bytes) { |
| 46 this.accumulator[dartx.add](bytes); |
| 47 } |
| 48 close() {} |
| 49 }; |
| 50 dart.addSimpleTypeTests(chunked_conversion2_test.MyChunkedSink); |
| 51 dart.setSignature(chunked_conversion2_test.MyChunkedSink, { |
| 52 methods: () => ({ |
| 53 add: dart.definiteFunctionType(dart.void, [core.List$(core.int)]), |
| 54 close: dart.definiteFunctionType(dart.void, []) |
| 55 }) |
| 56 }); |
| 57 chunked_conversion2_test.testAdapter = function() { |
| 58 let chunkedSink = new chunked_conversion2_test.MyChunkedSink(); |
| 59 let byteSink = convert.ByteConversionSink.from(chunkedSink); |
| 60 let bytes = JSArrayOfint().of([1]); |
| 61 byteSink.addSlice(bytes, 0, 1, false); |
| 62 bytes[dartx.set](0, 2); |
| 63 byteSink.addSlice(bytes, 0, 1, true); |
| 64 expect$.Expect.equals(1, dart.dindex(chunkedSink.accumulator[dartx.get](0),
0)); |
| 65 expect$.Expect.equals(2, dart.dindex(chunkedSink.accumulator[dartx.get](1),
0)); |
| 66 }; |
| 67 dart.fn(chunked_conversion2_test.testAdapter, VoidTovoid()); |
| 68 chunked_conversion2_test.main = function() { |
| 69 chunked_conversion2_test.testBase(); |
| 70 chunked_conversion2_test.testAdapter(); |
| 71 }; |
| 72 dart.fn(chunked_conversion2_test.main, VoidTovoid()); |
| 73 // Exports: |
| 74 exports.chunked_conversion2_test = chunked_conversion2_test; |
| 75 }); |
OLD | NEW |