tests/argument-types.rs: Test that we can pass a String to a virtual method

It works, but if we just do

  class Foo {
  }

  impl Foo {
      virtual fn blah(&self, ...) {}
  }

  class Bar: Foo {
  }

  // i.e. with no "impl Foo for Bar"

then this won't work:

  let bar = Bar::new();
  bar.blah(); // no method named `blah` found for type `Bar` in the current scope

We in fact have to specify

  impl Foo for Bar {}

Will fix this later.
parent de04153f
......@@ -87,6 +87,16 @@ gobject_gen! {
s.len()
}
virtual fn thirteen_string_len(&self, s: String) -> usize {
s.len()
}
}
#[generate("tests/generated/arguments-types2-gen.rs")]
class Test2: Test {
}
impl Test for Test2 {
}
}
......@@ -100,6 +110,10 @@ fn test() {
assert!(t.four(true));
assert!(!t.four(false));
assert_eq!(t.twelve_string_len("Hello world".to_string()), 11);
assert_eq!(t.thirteen_string_len("Hello world".to_string()), 11);
let t2 = Test2::new();
assert_eq!(t2.thirteen_string_len("Hello world".to_string()), 11);
let f = Foo::new();
assert!(!t.ten(&f));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment