| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // Test that instanceof works correctly with type variables. | 4 // Test that instanceof works correctly with type variables. |
| 5 | 5 |
| 6 part of GenericInstanceofTest.dart; | 6 part of GenericInstanceofTest.dart; |
| 7 | 7 |
| 8 class Foo<T> { | 8 class Foo<T> { |
| 9 Foo() {} | 9 Foo() {} |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 { | 57 { |
| 58 Foo foo = new Foo<List<Object>>(); | 58 Foo foo = new Foo<List<Object>>(); |
| 59 Expect.equals(true, foo.isT(new List(5))); | 59 Expect.equals(true, foo.isT(new List(5))); |
| 60 Expect.equals(true, foo.isT(new List<Object>(5))); | 60 Expect.equals(true, foo.isT(new List<Object>(5))); |
| 61 Expect.equals(true, foo.isT(new List<int>(5))); | 61 Expect.equals(true, foo.isT(new List<int>(5))); |
| 62 Expect.equals(true, foo.isT(new List<num>(5))); | 62 Expect.equals(true, foo.isT(new List<num>(5))); |
| 63 Expect.equals(true, foo.isT(new List<String>(5))); | 63 Expect.equals(true, foo.isT(new List<String>(5))); |
| 64 } | 64 } |
| 65 { | 65 { |
| 66 Foo foo = new Foo<List<int>>(); | 66 Foo foo = new Foo<List<int>>(); |
| 67 Expect.equals(true, foo.isT(new List(5))); | 67 Expect.equals(false, foo.isT(new List(5))); |
| 68 Expect.equals(false, foo.isT(new List<Object>(5))); | 68 Expect.equals(false, foo.isT(new List<Object>(5))); |
| 69 Expect.equals(true, foo.isT(new List<int>(5))); | 69 Expect.equals(true, foo.isT(new List<int>(5))); |
| 70 Expect.equals(false, foo.isT(new List<num>(5))); | 70 Expect.equals(false, foo.isT(new List<num>(5))); |
| 71 Expect.equals(false, foo.isT(new List<String>(5))); | 71 Expect.equals(false, foo.isT(new List<String>(5))); |
| 72 } | 72 } |
| 73 { | 73 { |
| 74 Foo foo = new Foo<List<num>>(); | 74 Foo foo = new Foo<List<num>>(); |
| 75 Expect.equals(true, foo.isT(new List(5))); | 75 Expect.equals(false, foo.isT(new List(5))); |
| 76 Expect.equals(false, foo.isT(new List<Object>(5))); | 76 Expect.equals(false, foo.isT(new List<Object>(5))); |
| 77 Expect.equals(true, foo.isT(new List<int>(5))); | 77 Expect.equals(true, foo.isT(new List<int>(5))); |
| 78 Expect.equals(true, foo.isT(new List<num>(5))); | 78 Expect.equals(true, foo.isT(new List<num>(5))); |
| 79 Expect.equals(false, foo.isT(new List<String>(5))); | 79 Expect.equals(false, foo.isT(new List<String>(5))); |
| 80 } | 80 } |
| 81 { | 81 { |
| 82 Foo foo = new Foo<List<String>>(); | 82 Foo foo = new Foo<List<String>>(); |
| 83 Expect.equals(true, foo.isT(new List(5))); | 83 Expect.equals(false, foo.isT(new List(5))); |
| 84 Expect.equals(false, foo.isT(new List<Object>(5))); | 84 Expect.equals(false, foo.isT(new List<Object>(5))); |
| 85 Expect.equals(false, foo.isT(new List<int>(5))); | 85 Expect.equals(false, foo.isT(new List<int>(5))); |
| 86 Expect.equals(false, foo.isT(new List<num>(5))); | 86 Expect.equals(false, foo.isT(new List<num>(5))); |
| 87 Expect.equals(true, foo.isT(new List<String>(5))); | 87 Expect.equals(true, foo.isT(new List<String>(5))); |
| 88 } | 88 } |
| 89 { | 89 { |
| 90 Foo foo = new Foo(); | 90 Foo foo = new Foo(); |
| 91 Expect.equals(true, foo.isListT(new List(5))); | 91 Expect.equals(true, foo.isListT(new List(5))); |
| 92 Expect.equals(true, foo.isListT(new List<Object>(5))); | 92 Expect.equals(true, foo.isListT(new List<Object>(5))); |
| 93 Expect.equals(true, foo.isListT(new List<int>(5))); | 93 Expect.equals(true, foo.isListT(new List<int>(5))); |
| 94 Expect.equals(true, foo.isListT(new List<num>(5))); | 94 Expect.equals(true, foo.isListT(new List<num>(5))); |
| 95 Expect.equals(true, foo.isListT(new List<String>(5))); | 95 Expect.equals(true, foo.isListT(new List<String>(5))); |
| 96 } | 96 } |
| 97 { | 97 { |
| 98 Foo foo = new Foo<Object>(); | 98 Foo foo = new Foo<Object>(); |
| 99 Expect.equals(true, foo.isListT(new List(5))); | 99 Expect.equals(true, foo.isListT(new List(5))); |
| 100 Expect.equals(true, foo.isListT(new List<Object>(5))); | 100 Expect.equals(true, foo.isListT(new List<Object>(5))); |
| 101 Expect.equals(true, foo.isListT(new List<int>(5))); | 101 Expect.equals(true, foo.isListT(new List<int>(5))); |
| 102 Expect.equals(true, foo.isListT(new List<num>(5))); | 102 Expect.equals(true, foo.isListT(new List<num>(5))); |
| 103 Expect.equals(true, foo.isListT(new List<String>(5))); | 103 Expect.equals(true, foo.isListT(new List<String>(5))); |
| 104 } | 104 } |
| 105 { | 105 { |
| 106 Foo foo = new Foo<int>(); | 106 Foo foo = new Foo<int>(); |
| 107 Expect.equals(true, foo.isListT(new List(5))); | 107 Expect.equals(false, foo.isListT(new List(5))); |
| 108 Expect.equals(false, foo.isListT(new List<Object>(5))); | 108 Expect.equals(false, foo.isListT(new List<Object>(5))); |
| 109 Expect.equals(true, foo.isListT(new List<int>(5))); | 109 Expect.equals(true, foo.isListT(new List<int>(5))); |
| 110 Expect.equals(false, foo.isListT(new List<num>(5))); | 110 Expect.equals(false, foo.isListT(new List<num>(5))); |
| 111 Expect.equals(false, foo.isListT(new List<String>(5))); | 111 Expect.equals(false, foo.isListT(new List<String>(5))); |
| 112 } | 112 } |
| 113 { | 113 { |
| 114 Foo foo = new Foo<num>(); | 114 Foo foo = new Foo<num>(); |
| 115 Expect.equals(true, foo.isListT(new List(5))); | 115 Expect.equals(false, foo.isListT(new List(5))); |
| 116 Expect.equals(false, foo.isListT(new List<Object>(5))); | 116 Expect.equals(false, foo.isListT(new List<Object>(5))); |
| 117 Expect.equals(true, foo.isListT(new List<int>(5))); | 117 Expect.equals(true, foo.isListT(new List<int>(5))); |
| 118 Expect.equals(true, foo.isListT(new List<num>(5))); | 118 Expect.equals(true, foo.isListT(new List<num>(5))); |
| 119 Expect.equals(false, foo.isListT(new List<String>(5))); | 119 Expect.equals(false, foo.isListT(new List<String>(5))); |
| 120 } | 120 } |
| 121 { | 121 { |
| 122 Foo foo = new Foo<String>(); | 122 Foo foo = new Foo<String>(); |
| 123 Expect.equals(true, foo.isListT(new List(5))); | 123 Expect.equals(false, foo.isListT(new List(5))); |
| 124 Expect.equals(false, foo.isListT(new List<Object>(5))); | 124 Expect.equals(false, foo.isListT(new List<Object>(5))); |
| 125 Expect.equals(false, foo.isListT(new List<int>(5))); | 125 Expect.equals(false, foo.isListT(new List<int>(5))); |
| 126 Expect.equals(false, foo.isListT(new List<num>(5))); | 126 Expect.equals(false, foo.isListT(new List<num>(5))); |
| 127 Expect.equals(true, foo.isListT(new List<String>(5))); | 127 Expect.equals(true, foo.isListT(new List<String>(5))); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 } | 130 } |
| OLD | NEW |