Merge remote-tracking branch 'upstream/master' into init_auto
[nit.git] / tests / contracts_virtual_type.nit
similarity index 73%
rename from tests/test_ropes_buffer_reverse.nit
rename to tests/contracts_virtual_type.nit
index 1d8033c..0e601c7 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-module test_ropes_buffer_reverse
+# Test the creation of contract with virtual type
 
-import core
+class MyClass
 
-redef fun maxlen do return 3
+       type VIRTUAL: Int
 
-var buffer = new RopeBuffer
+       fun foo(x: VIRTUAL)
+       is
+               expect(x == 1)
+       do
 
-buffer.reverse
-print "/{buffer}/"
+       end
+end
 
-buffer.append("x" * (maxlen + 1))
-buffer.add 'y'
-buffer.reverse
-print buffer.to_s
+var first = new MyClass
+first.foo(1)
+first.foo(3) # Fail 3 != 1