Skip to content

Commit

Permalink
fix development_mode_not_allowed test
Browse files Browse the repository at this point in the history
  • Loading branch information
kklas committed Sep 5, 2024
1 parent ae27f76 commit 04ed464
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/sui-move-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,9 @@ impl PackageHooks for SuiPackageHooks {
&self,
manifest: &SourceManifest,
) -> anyhow::Result<PackageIdentifier> {
if !cfg!(debug_assertions) && manifest.package.edition == Some(Edition::DEVELOPMENT) {
if (!cfg!(debug_assertions) || cfg!(test))
&& manifest.package.edition == Some(Edition::DEVELOPMENT)
{
return Err(Edition::DEVELOPMENT.unknown_edition_error());
}
Ok(manifest.package.name)
Expand Down
9 changes: 8 additions & 1 deletion crates/sui-move-build/src/unit_tests/build_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

use std::path::Path;

use move_compiler::editions::Edition;

use crate::BuildConfig;

#[test]
Expand Down Expand Up @@ -37,5 +39,10 @@ fn development_mode_not_allowed() {
.join("unit_tests")
.join("data")
.join("no_development_mode");
assert!(BuildConfig::new_for_testing().build(&path).is_err());
let err = BuildConfig::new_for_testing()
.build(&path)
.expect_err("Should have failed due to unsupported edition");
assert!(err
.to_string()
.contains(&Edition::DEVELOPMENT.unknown_edition_error().to_string()));
}

0 comments on commit 04ed464

Please sign in to comment.