Object Assertions
An assertion tool to verify Objects.
-
GdUnitObjectAssert
Function Description is_null Verifies that the current value is null. is_not_null Verifies that the current value is not null. is_equal Verifies that the current value is equal to expected one. is_not_equal Verifies that the current value is not equal to expected one. is_same Verifies that the current value is the same as the given one. is_not_same Verifies that the current value is not the same as the given one. is_instanceof Verifies that the current value is an instance of the given type. is_not_instanceof Verifies that the current value is not an instance of the given type. -
IObjectAssert
Function Description IsNull Verifies that the current value is null. IsNotNull Verifies that the current value is not null. IsEqual Verifies that the current value is equal to expected one. IsNotRqual Verifies that the current value is not equal to expected one. IsSame Verifies that the current value is the same as the given one. IsNotSame Verifies that the current value is not the same as the given one. IsInstanceOf Verifies that the current value is an instance of the given type. IsNotInstanceOf Verifies that the current value is not an instance of the given type.
Object Assert Examples
is_equal
Verifies that the current value is equal to expected one.
-
func assert_object(<current>).is_equal(<expected>) -> GdUnitObjectAssert
# this assertion succeeds assert_object(Mesh.new()).is_equal(Mesh.new()) # should fail because the current is an Mesh and we expect equal to a Skin assert_object(Mesh.new()).is_equal(Skin.new())
-
public static IObjectAssert AssertThat(<current>).IsEqual(<expected>);
// this assertion succeeds AssertThat(new Godot.Mesh()).IsEqual(new Godot.Mesh()); // should fail because the current is an Mesh and we expect equal to a Skin AssertThat(new Godot.Mesh()).IsEqual(new Godot.Skin());
is_not_equal
Verifies that the current value is not equal to expected one.
-
func assert_object(<current>).is_not_equal(<expected>) -> GdUnitObjectAssert
# this assertion succeeds assert_object(Mesh.new()).is_not_equal(Skin.new()) # should fail because the current is an Mesh and we expect not equal to a Mesh assert_object(Mesh.new()).is_not_equal(Mesh.new())
-
public static IObjectAssert AssertThat(<current>).IsNotEqual(<expected>);
// this assertion succeeds AssertThat(new Godot.Mesh()).IsNotEqual(new Godot.Skin()); // should fail because the current is an Mesh and we expect not equal to a Mesh AssertThat(new Godot.Mesh()).IsNotEqual(new Godot.Mesh());
is_null
Verifies that the current value is null.
-
func assert_object(<current>).is_null() -> GdUnitObjectAssert
# this assertion succeeds assert_object(null).is_null() # should fail because it the current value is an Mesh and not null assert_object(Mesh.new()).is_null()
-
public static IObjectAssert AssertThat(<current>).IsNull();
// this assertion succeeds AssertThat(null).IsNull(); // should fail because it the current value is an Mesh and not null AssertThat(new Godot.Mesh()).IsNull();
is_not_null
Verifies that the current value is not null.
-
func assert_object(<current>).is_not_null() -> GdUnitObjectAssert
# this assertion succeeds assert_object(Mesh.new()).is_not_null() # should fail because the current value is null assert_object(null).is_not_null()
-
public static IObjectAssert AssertThat(<current>).IsNotNull();
// this assertion succeeds AssertThat(new Godot.Mesh()).IsNotNull(); // should fail because the current value is null AssertThat(null).IsNotNull();
is_same
Verifies that the current value is the same as the given one.
-
func assert_object(<current>).is_same(<expected>) -> GdUnitObjectAssert
# this assertion succeeds var obj1 = Node.new() var obj2 = obj1 var obj3 = obj1.duplicate() assert_object(obj1).is_same(obj1) assert_object(obj1).is_same(obj2) assert_object(obj2).is_same(obj1) # should fail because because the current is not same instance as expected value assert_object(null).is_same(obj1) assert_object(obj1).is_same(obj3) assert_object(obj3).is_same(obj1) assert_object(obj3).is_same(obj2)
-
public static IObjectAssert AssertThat(<current>).IsSame();
// this assertion succeeds var obj1 = new Godot.Node(); var obj2 = obj1; var obj3 = obj1.Duplicate(); AssertThat(obj1).IsSame(obj1); AssertThat(obj1).IsSame(obj2); AssertThat(obj2).IsSame(obj1); // should fail because because the current is not same instance as expected value AssertThat(null).IsSame(obj1); AssertThat(obj1).IsSame(obj3); AssertThat(obj3).IsSame(obj1); AssertThat(obj3).IsSame(obj2);
is_not_same
Verifies that the current value is not the same as the given one.
-
func assert_object(<current>).is_not_same(<expected>) -> GdUnitObjectAssert
# this assertion succeeds var obj1 = Node.new() var obj2 = obj1 var obj3 = obj1.duplicate() assert_object(null).is_not_same(obj1) assert_object(obj1).is_not_same(obj3) assert_object(obj3).is_not_same(obj1) assert_object(obj3).is_not_same(obj2) # should fail because because the current is the same instance as expected value assert_object(obj1).is_not_same(obj1) assert_object(obj1).is_not_same(obj2) assert_object(obj2).is_not_same(obj1)
-
public static IObjectAssert AssertThat(<current>).IsNotSame();
// this assertion succeeds var obj1 = new Godot.Node(); var obj2 = obj1; var obj3 = obj1.Duplicate(); AssertThat(null).IsNotSame(obj1); AssertThat(obj1).IsNotSame(obj3); AssertThat(obj3).IsNotSame(obj1); AssertThat(obj3).IsNotSame(obj2); // should fail because because the current is the same instance as expected value AssertThat(obj1).IsNotSame(obj1) AssertThat(obj1).IsNotSame(obj2) AssertThat(obj2).IsNotSame(obj1)
is_instanceof
Verifies that the current value is an instance of the given type.
-
func assert_object(<current>).is_instanceof(<expected>) -> GdUnitObjectAssert
# this assertion succeeds assert_object(Path.new()).is_instanceof(Node) # should fail because the current is not a instance of class Tree assert_object(Path.new()).is_instanceof(Tree)
-
public static IObjectAssert AssertThat(<current>).IsInstanceOf<Type>();
// this assertion succeeds AssertThat(new Godot.Path()).IsInstanceOf<Node>(); // should fail because the current is not a instance of class Tree AssertThat(new Godot.Path()).IsInstanceOf<Tree>();
is_not_instanceof
Verifies that the current value is not an instance of the given type.
-
func assert_object(<current>).is_not_instanceof(<expected>) -> GdUnitObjectAssert
# this assertion succeeds assert_object(Path.new()).is_not_instanceof(Tree) # should fail because Path is a instance of class Node (Path < Spatial < Node < Object) assert_object(Path.new()).is_not_instanceof(Node)
-
public static IObjectAssert AssertThat(<current>).IsNotInstanceOf<Type>();
// this assertion succeeds AssertThat(new Godot.Path()).IsNotInstanceOf<Tree>(); // should fail because Path is a instance of class Node (Path < Spatial < Node < Object) AssertThat(new Godot.Path()).IsNotInstanceOf<Node>();