Skip to content

Commit ac8c18f

Browse files
committed
pass the whole scripting suite
1 parent 8dbfd2b commit ac8c18f

File tree

96 files changed

+310
-327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+310
-327
lines changed

crates/languages/bevy_mod_scripting_rhai/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua

Lines changed: 0 additions & 7 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let entity = world.spawn_.call();
2+
let type = world.get_type_by_name.call("TestComponent");
3+
4+
assert_throws(||{
5+
world.add_default_component.call(entity, type);
6+
},"Missing type data ReflectDefault or ReflectFromWorld for type: .*TestComponent.*");

crates/languages/bevy_mod_scripting_rhai/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua

Lines changed: 0 additions & 9 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let entity = world.spawn_.call();
2+
let _type = world.get_type_by_name.call("CompWithDefaultAndComponentData");
3+
world.add_default_component.call(entity, _type);
4+
5+
let added = world.has_component.call(entity, _type);
6+
assert(type_of(added) != "()", "Component not added");
7+
8+
let component = world.get_component.call(entity, _type);
9+
assert(component["_0"] == "Default", "Component did not have default value, got: " + component["_0"]);

crates/languages/bevy_mod_scripting_rhai/tests/data/add_default_component/component_with_default_no_component_data_errors.lua

Lines changed: 0 additions & 6 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let entity = world.spawn_.call();
2+
let _type = world.get_type_by_name.call("CompWithDefault");
3+
4+
assert_throws(||{
5+
world.add_default_component.call(entity, _type);
6+
}, "Missing type data ReflectComponent for type: .*CompWithDefault.*")

crates/languages/bevy_mod_scripting_rhai/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua

Lines changed: 0 additions & 9 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let entity = world.spawn_.call();
2+
let _type = world.get_type_by_name.call("CompWithFromWorldAndComponentData");
3+
world.add_default_component.call(entity, _type);
4+
5+
let added = world.has_component.call(entity, _type);
6+
assert(type_of(added) != "()", "Component not added");
7+
8+
let component = world.get_component.call(entity, _type);
9+
assert(component["_0"] == "Default", "Component did not have default value, got: " + component["_0"])

crates/languages/bevy_mod_scripting_rhai/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua

Lines changed: 0 additions & 6 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let entity = world.spawn_.call();
2+
let _type = world.get_type_by_name.call("CompWithFromWorld");
3+
4+
assert_throws(||{
5+
world.add_default_component.call(entity, _type);
6+
}, "Missing type data ReflectComponent for type: .*CompWithFromWorld.*")

crates/languages/bevy_mod_scripting_rhai/tests/data/despawn/despawns_only_root.lua

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let entity = world.spawn_.call();
2+
let child = world.spawn_.call();
3+
world.push_children.call(entity, [child]);
4+
world.despawn.call(entity);
5+
6+
assert(world.has_entity.call(entity) == false, "Parent should be despawned");
7+
assert(world.has_entity.call(child) == true, "Child should not be despawned");

crates/languages/bevy_mod_scripting_rhai/tests/data/despawn/invalid_entity_errors.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assert_throws(||{
2+
world.despawn_recursive.call(Entity.from_raw.call(9999))
3+
}, "Missing or invalid entity");

crates/languages/bevy_mod_scripting_rhai/tests/data/despawn_descendants/despawns_only_child.lua

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let entity = world.spawn_.call();
2+
let child = world.spawn_.call();
3+
world.push_children.call(entity, [child]);
4+
world.despawn_descendants.call(entity);
5+
6+
assert(world.has_entity.call(entity) == true, "Parent should not be despawned");
7+
assert(world.has_entity.call(child) == false, "Child should be despawned");

crates/languages/bevy_mod_scripting_rhai/tests/data/despawn_descendants/invalid_entity_errors.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assert_throws(||{
2+
world.despawn_recursive.call(Entity.from_raw.call(9999));
3+
}, "Missing or invalid entity")

crates/languages/bevy_mod_scripting_rhai/tests/data/despawn_recursive/despawns_recursively.lua

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let entity = world.spawn_.call();
2+
let child = world.spawn_.call();
3+
world.push_children.call(entity, [child]);
4+
world.despawn_recursive.call(entity);
5+
6+
assert(world.has_entity.call(entity) == false, "Parent should be despawned");
7+
assert(world.has_entity.call(child) == false, "Child should be despawned");

crates/languages/bevy_mod_scripting_rhai/tests/data/despawn_recursive/invalid_entity_errors.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assert_throws(||{
2+
world.despawn_recursive.call(Entity.from_raw.call(9999));
3+
}, "Missing or invalid entity")

crates/languages/bevy_mod_scripting_rhai/tests/data/get_children/has_children_returns_them.lua

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let entity = world.spawn_.call();
2+
let child = world.spawn_.call();
3+
4+
world.push_children.call(entity, [child]);
5+
6+
let children = world.get_children.call(entity);
7+
8+
assert(children.len == 1, "Expected 1 child");
9+
assert(children[0].index.call() == child.index.call(), "Child is the wrong entity");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_children/invalid_entity_errors.lua

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assert_throws(||{
2+
world.get_children.call(Entity.from_raw.call(9999));
3+
}, "Missing or invalid entity");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_children/no_children_returns_empty_table.lua

Lines changed: 0 additions & 4 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let entity = world.spawn_.call();
2+
let children = world.get_children.call(entity);
3+
4+
assert(children.len == 0);

crates/languages/bevy_mod_scripting_rhai/tests/data/get_component/component_no_component_data.lua

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let component = world.get_type_by_name.call("CompWithDefault");
2+
let entity = world._get_entity_with_test_component.call("CompWithDefault");
3+
let retrieved = world.get_component.call(entity, component);
4+
5+
assert(type_of(retrieved) != "()", "Component was not found");
6+
assert(retrieved["_0"] == "Initial Value", "Component data was not retrieved correctly, retrieved._0 was: " + retrieved["_0"]);

crates/languages/bevy_mod_scripting_rhai/tests/data/get_component/component_with_component_data.lua

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let component = world.get_type_by_name.call("TestComponent");
2+
let entity = world._get_entity_with_test_component.call("TestComponent");
3+
let retrieved = world.get_component.call(entity, component);
4+
5+
assert(type_of(retrieved) != "()", "Component was not found");
6+
assert(retrieved.strings[0] == "Initial", "Component data was not retrieved correctly, retrieved.strings[0] was: " + retrieved.strings[0]);

crates/languages/bevy_mod_scripting_rhai/tests/data/get_component/empty_entity_component_with_component_data.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let component = world.get_type_by_name.call("TestComponent");
2+
let entity = world.spawn_.call();
3+
let retrieved = world.get_component.call(entity, component);
4+
5+
assert(type_of(retrieved) == "()", "Component found");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_parent/has_parent_returns_it.lua

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let entity = world.spawn_.call();
2+
let child = world.spawn_.call();
3+
4+
world.push_children.call(entity, [child]);
5+
6+
let parent = world.get_parent.call(child);
7+
8+
assert(type_of(parent) != "()", "Expected a parent");
9+
assert(parent.index.call() == entity.index.call(), "Parent is the wrong entity");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_parent/invalid_entity_errors.lua

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
assert_throws(||{
3+
world.get_parent.call(Entity.from_raw.call(9999));
4+
}, "Missing or invalid entity");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_parent/no_parent_returns_nil.lua

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let entity = world.spawn_.call();
2+
let parent = world.get_parent.call(entity);
3+
4+
assert(type_of(parent) == "()", "Expected no parents");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_resource/missing_resource_returns_nil.lua

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let type = world._get_mock_resource_type.call();
2+
assert(type_of(world.get_resource.call(type)) == "()", "Resource should not exist");

crates/languages/bevy_mod_scripting_rhai/tests/data/get_resource/no_resource_data_returns_resource.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let resource = world.get_type_by_name.call("ResourceWithDefault");
2+
3+
let retrieved = world.get_resource.call(resource);
4+
assert(type_of(retrieved) != "()", "Resource should exist");
5+
assert(retrieved["_0"] == "Initial Value", "Resource should have default value but got: " + retrieved["_0"]);

crates/languages/bevy_mod_scripting_rhai/tests/data/get_resource/with_resource_data_returns_resource.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let resource = world.get_type_by_name.call("TestResource");
2+
3+
let retrieved = world.get_resource.call(resource);
4+
assert(type_of(retrieved) != "()", "Resource should exist");
5+
assert(retrieved.bytes[1] == 1, "Resource should have default value but got resource with #retrieved.bytes[1]: " + retrieved.bytes[1]);

crates/languages/bevy_mod_scripting_rhai/tests/data/has_component/empty_entity_mock_component_is_false.lua

Lines changed: 0 additions & 4 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let entity = world.spawn_.call();
2+
let type = world._get_mock_component_type.call();
3+
4+
assert(world.has_component.call(entity, type) == false, "Entity should not have component");

crates/languages/bevy_mod_scripting_rhai/tests/data/has_component/no_component_data.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let entity = world._get_entity_with_test_component.call("CompWithDefault");
2+
let component = world.get_type_by_name.call("CompWithDefault");
3+
assert(world.has_component.call(entity, component) == true, "Component was not found");

crates/languages/bevy_mod_scripting_rhai/tests/data/has_component/with_component_data.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let entity = world._get_entity_with_test_component.call("TestComponent");
2+
let component = world.get_type_by_name.call("TestComponent");
3+
assert(world.has_component.call(entity, component) == true, "Component was not found");

crates/languages/bevy_mod_scripting_rhai/tests/data/has_resource/existing_no_resource_data.lua

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let component = world.get_type_by_name.call("ResourceWithDefault");
2+
assert(world.has_resource.call(component) == true, "Resource was not found");

crates/languages/bevy_mod_scripting_rhai/tests/data/has_resource/existing_with_resource_data.lua

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let component = world.get_type_by_name.call("TestResource");
2+
assert(world.has_resource.call(component) == true, "Resource was not found");

crates/languages/bevy_mod_scripting_rhai/tests/data/has_resource/missing_resource_mock_resource_is_false.lua

Lines changed: 0 additions & 2 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let type = world._get_mock_resource_type.call();
2+
assert(world.has_resource.call(type) == false, "Resource should not exist");

crates/languages/bevy_mod_scripting_rhai/tests/data/insert_children/adding_empty_list_does_nothing.lua

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)