Skip to content

Commit

Permalink
fix: change tag separator to - (#2132)
Browse files Browse the repository at this point in the history
* wip

* fix tests
  • Loading branch information
glihm authored Jul 3, 2024
1 parent f1f89ad commit 93b38dd
Show file tree
Hide file tree
Showing 78 changed files with 1,658 additions and 397 deletions.
2 changes: 1 addition & 1 deletion bin/sozo/tests/register_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async fn reregister_models() {
let rpc_url = &sequencer.url().to_string();

let moves_model =
migration.models.iter().find(|m| m.diff.tag == "dojo_examples:Moves").unwrap();
migration.models.iter().find(|m| m.diff.tag == "dojo_examples-Moves").unwrap();
let moves_model_class_hash = &format!("0x{:x}", moves_model.diff.local_class_hash);
let args_vec = [
"register",
Expand Down
5 changes: 3 additions & 2 deletions bin/sozo/tests/test_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ mod utils;
use std::fs;

use utils::snapbox::get_snapbox;
use utils::stdout::expected_stdout;

#[test]
fn test_invalid_cairo_version() {
let path = fs::canonicalize("./tests/test_data/invalid_cairo_version");
let assert = get_snapbox().arg("build").current_dir(path.unwrap()).assert().failure();
assert.stdout_eq(expected_stdout("wrong-cairo-version"));
assert.stdout_matches(
"[..]Specified cairo version not supported by dojo. Please verify and update dojo[..]",
);
}
16 changes: 8 additions & 8 deletions crates/dojo-bindgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ mod tests {

assert_eq!(data.world.name, "dojo_example");

let pos = data.models.get("Position").unwrap();
assert_eq!(pos.tag, "dojo_examples:Position");
let pos = data.models.get("dojo_examples-Position").unwrap();
assert_eq!(pos.tag, "dojo_examples-Position");

let moves = data.models.get("Moves").unwrap();
assert_eq!(moves.tag, "dojo_examples:Moves");
let moves = data.models.get("dojo_examples-Moves").unwrap();
assert_eq!(moves.tag, "dojo_examples-Moves");

let moved = data.models.get("dojo_examples:Message").unwrap();
assert_eq!(moved.tag, "Message");
let moved = data.models.get("dojo_examples-Message").unwrap();
assert_eq!(moved.tag, "dojo_examples-Message");

let player_config = data.models.get("dojo_examples:PlayerConfig").unwrap();
assert_eq!(player_config.tag, "dojo_examples:PlayerConfig");
let player_config = data.models.get("dojo_examples-PlayerConfig").unwrap();
assert_eq!(player_config.tag, "dojo_examples-PlayerConfig");
}
}
2 changes: 1 addition & 1 deletion crates/dojo-bindgen/src/plugins/typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export function defineContractComponents(world: World) {
}

// Formats a contract tag into a pretty contract name
// eg. dojo_examples:actions -> Actions
// eg. dojo_examples-actions -> Actions
fn formatted_contract_name(tag: &str) -> String {
capitalize(&get_name_from_tag(tag))
}
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-bindgen/src/plugins/typescript_v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ type {} = ",
}

// Formats a contract tag into a pretty contract name
// eg. dojo_examples:actions -> Actions
// eg. dojo_examples-actions -> Actions
fn formatted_contract_name(tag: &str) -> String {
capitalize(&get_name_from_tag(tag))
}
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-bindgen/src/plugins/unity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public class {} : ModelInstance {{
}

// Formats a contract tag into a pretty contract name
// eg. dojo_examples:actions.json -> Actions
// eg. dojo_examples-actions.json -> Actions
fn formatted_contract_name(tag: &str) -> String {
capitalize(&get_name_from_tag(tag))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"type": "event",
"name": "compiler_cairo::cairo_24::cairo_v240::Event",
"kind": "enum",
"variants": []
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"type": "event",
"name": "compiler_cairo::cairo_26::cairo_v260::Event",
"kind": "enum",
"variants": []
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
[
{
"type": "impl",
"name": "WorldProviderImpl",
"interface_name": "dojo::world::IWorldProvider"
},
{
"type": "struct",
"name": "dojo::world::IWorldDispatcher",
"members": [
{
"name": "contract_address",
"type": "core::starknet::contract_address::ContractAddress"
}
]
},
{
"type": "interface",
"name": "dojo::world::IWorldProvider",
"items": [
{
"type": "function",
"name": "world",
"inputs": [],
"outputs": [
{
"type": "dojo::world::IWorldDispatcher"
}
],
"state_mutability": "view"
}
]
},
{
"type": "impl",
"name": "UpgradableImpl",
"interface_name": "dojo::components::upgradeable::IUpgradeable"
},
{
"type": "interface",
"name": "dojo::components::upgradeable::IUpgradeable",
"items": [
{
"type": "function",
"name": "upgrade",
"inputs": [
{
"name": "new_class_hash",
"type": "core::starknet::class_hash::ClassHash"
}
],
"outputs": [],
"state_mutability": "external"
}
]
},
{
"type": "constructor",
"name": "constructor",
"inputs": []
},
{
"type": "event",
"name": "dojo::components::upgradeable::upgradeable::Upgraded",
"kind": "struct",
"members": [
{
"name": "class_hash",
"type": "core::starknet::class_hash::ClassHash",
"kind": "data"
}
]
},
{
"type": "event",
"name": "dojo::components::upgradeable::upgradeable::Event",
"kind": "enum",
"variants": [
{
"name": "Upgraded",
"type": "dojo::components::upgradeable::upgradeable::Upgraded",
"kind": "nested"
}
]
},
{
"type": "event",
"name": "dojo::base::base::Event",
"kind": "enum",
"variants": [
{
"name": "UpgradeableEvent",
"type": "dojo::components::upgradeable::upgradeable::Event",
"kind": "flat"
}
]
}
]
Loading

0 comments on commit 93b38dd

Please sign in to comment.