Skip to content

Commit

Permalink
fix kebab case issue (#274)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian H <[email protected]>
  • Loading branch information
fibonacci1729 authored Apr 17, 2024
1 parent e1715b0 commit db4277e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
};
use anyhow::{bail, Context, Result};
use cargo_component_core::registry::DecodedDependency;
use heck::ToKebabCase;
use indexmap::{IndexMap, IndexSet};
use semver::Version;
use std::{
Expand Down Expand Up @@ -445,7 +446,7 @@ impl<'a> BindingsGenerator<'a> {

fn target_empty_world(resolution: &PackageDependencyResolution) -> (Resolve, WorldId) {
let mut resolve = Resolve::default();
let name = resolution.metadata.name.clone();
let name = resolution.metadata.name.to_kebab_case();
let pkg_name = PackageName {
namespace: "component".to_string(),
name: name.clone(),
Expand Down
15 changes: 15 additions & 0 deletions tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ fn it_builds_debug() -> Result<()> {
Ok(())
}

#[test]
fn it_builds_a_bin_project_with_snake_case() -> Result<()> {
let project = Project::new_bin("hello_world")?;

project
.cargo_component("build --release")
.assert()
.stderr(contains("Finished release [optimized] target(s)"))
.success();

validate_component(&project.release_wasm("hello_world"))?;

Ok(())
}

#[test]
fn it_builds_a_bin_project() -> Result<()> {
let project = Project::new_bin("foo")?;
Expand Down

0 comments on commit db4277e

Please sign in to comment.