Commit 0df98c57 authored by Rico Tzschichholz's avatar Rico Tzschichholz

tests: Add more invalid class tests to increase coverage

parent 34dbda21
......@@ -467,6 +467,15 @@ TESTS = \
parser/yield-method.test \
parser/bug728574.vala \
parser/bug749576.vala \
semantic/class-base-type-invalid.test \
semantic/class-base-type-less-accessible.test \
semantic/class-compact-derived-instance-field.test \
semantic/class-compact-interface.test \
semantic/class-missing-implement-interface-method.test \
semantic/class-missing-implement-interface-property.test \
semantic/class-missing-implement-method.test \
semantic/class-missing-implement-property.test \
semantic/class-missing-prerequisites.test \
semantic/class-too-few-type-arguments.test \
semantic/class-too-many-type-arguments.test \
semantic/constant-extern.test \
......
......@@ -3,10 +3,15 @@ class Foo {
public void foo () ensures (ensured = true) {
}
public string bar () ensures (result.length >= 3) {
return "bar";
}
}
void main () {
var foo = new Foo();
foo.foo();
assert(foo.ensured);
}
\ No newline at end of file
assert(foo.bar () == "bar");
}
Invalid Code
class Bar {
}
public class Foo : Bar {
}
void main () {
}
Invalid Code
struct Bar {
public int i;
}
class Foo : Bar {
}
void main () {
}
Invalid Code
[Compact]
class Bar {
}
[Compact]
class Foo : Bar {
public int i;
}
void main () {
}
Invalid Code
interface Bar {
}
[Compact]
class Foo : Bar {
}
void main () {
}
Invalid Code
interface Bar {
public abstract void bar ();
}
class Foo : Bar {
}
void main () {
}
Invalid Code
interface Bar {
public abstract string bar { get; set; }
}
class Foo : Bar {
}
void main () {
}
Invalid Code
abstract class Bar {
public abstract void bar ();
}
class Foo : Bar {
}
void main () {
}
Invalid Code
abstract class Bar {
public abstract string bar { get; set; }
}
class Foo : Bar {
}
void main () {
}
Invalid Code
interface IFoo {
}
interface IBaz {
}
interface IBar : IFoo, IBaz {
}
class Bar : IBar {
}
class Foo : Bar {
}
void main () {
}
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