Wiki

root/cobra/trunk/Tests/100-basics/072-equals.cobra

Revision 1177, 482 bytes (checked in by chuck, 4 years ago)

Importing test cases.

  • Property svn:eol-style set to native
Line 
1namespace Test
2   
3    class Test
4       
5        def main
6            is shared
7           
8            a as Object = 'aoeu'
9           
10            t1 as String = 'ao'
11            t2 as String = 'eu'
12            if (a to String).length==4  # the condition forces b to be constructed at runtime
13                b as Object = t1 + t2
14            else
15                b as Object = ''
16            assert b  # .warning. always
17            assert a is not b
18
19            # a and b are statically typed as `object`
20            # in C# this would cause == to return false
21            # but in Cobra, we get the correct answer:
22            assert a==b
Note: See TracBrowser for help on using the browser.