Skip to content

Commit 6199c72

Browse files
authored
Merge pull request #6189 from BowTiedWoo/test/clarity-wasm-fix-intermediary-response-tests
[clarity-wasm-tests] Fix UncheckedIntermediaryResponse Error in Tests
2 parents a475f76 + 703f050 commit 6199c72

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

stackslib/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ rlimit = "0.10.2"
9999
chrono = "0.4.19"
100100

101101
[features]
102-
default = []
102+
default = ["clarity-wasm"]
103103
profile-sqlite = []
104104
disable-costs = []
105105
developer-mode = ["clarity/developer-mode"]
106106
monitoring_prom = ["prometheus"]
107107
slog_json = ["stacks-common/slog_json", "clarity/slog_json", "pox-locking/slog_json"]
108108
testing = ["chrono"]
109+
clarity-wasm = []
109110

110111
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
111112
sha2 = { version = "0.10", features = ["asm"] }

stackslib/src/clarity_vm/tests/costs.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,12 +820,18 @@ fn epoch205_nfts(use_mainnet: bool) {
820820
);
821821
}
822822

823+
// Test not valid for clarity-wasm runtime
824+
// Contracts would error in the static analysis pass.
823825
#[test]
826+
#[cfg(not(feature = "clarity-wasm"))]
824827
fn epoch205_nfts_mainnet() {
825828
epoch205_nfts(true)
826829
}
827830

831+
// Test not valid for clarity-wasm runtime
832+
// Contracts would error in the static analysis pass.
828833
#[test]
834+
#[cfg(not(feature = "clarity-wasm"))]
829835
fn epoch205_nfts_testnet() {
830836
epoch205_nfts(false)
831837
}

stackslib/src/clarity_vm/tests/events.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ fn test_emit_stx_burn_nok() {
271271
assert!(events.is_empty());
272272
}
273273

274+
// Test not valid for clarity-wasm runtime
275+
// Contracts would error in the static analysis pass.
276+
#[cfg(not(feature = "clarity-wasm"))]
274277
#[test]
275278
fn test_emit_nested_print_nok() {
276279
let contract = "(define-public (emit-event-nok)
@@ -288,6 +291,23 @@ fn test_emit_nested_print_nok() {
288291
assert_eq!(events.len(), 1);
289292
}
290293

294+
#[test]
295+
fn test_emit_nested_print_nok_valid_contract() {
296+
let contract = "(define-public (emit-event-nok)
297+
(begin
298+
(print \"bar\")
299+
(err u1)))
300+
(define-public (emit-event-ok)
301+
(begin
302+
(unwrap-err! (emit-event-nok) (err u1))
303+
(print \"foo\")
304+
(ok u1)))";
305+
306+
let (value, events) = helper_execute(contract, "emit-event-ok");
307+
assert_eq!(value, Value::okay(Value::UInt(1)).unwrap());
308+
assert_eq!(events.len(), 1);
309+
}
310+
291311
#[test]
292312
fn test_emit_ft_transfer_ok() {
293313
let contract = "(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)

0 commit comments

Comments
 (0)