|
Revision 1177, 0.6 KB
(checked in by chuck, 4 years ago)
|
|
Importing test cases.
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | # .skip. |
|---|
| 2 | # Cobra gives more informative InvalidCastExceptions than Mono or .NET which do not report the source type, destination type or value.toString--which is annoying |
|---|
| 3 | class Foo |
|---|
| 4 | |
|---|
| 5 | def main is shared |
|---|
| 6 | a = true to Object |
|---|
| 7 | expect InvalidCastException |
|---|
| 8 | b = a to int |
|---|
| 9 | try |
|---|
| 10 | b = a to int |
|---|
| 11 | catch exc as InvalidCastException |
|---|
| 12 | s = exc.toString.toLower # Cannot cast from source type to destination type. Source type is "bool". Destination type is "int". Value = true |
|---|
| 13 | assert 'cannot cast' in s |
|---|
| 14 | assert 'source type is "bool"' in s |
|---|
| 15 | assert 'destination type is "int"' in s |
|---|
| 16 | assert 'value = true' in s |
|---|
| 17 | CobraCore.noOp(b) |
|---|