Skip to content

Commit

Permalink
test no empty variadic auto insert
Browse files Browse the repository at this point in the history
  • Loading branch information
dragazo committed Sep 27, 2023
1 parent d6bddb8 commit 5447941
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/test/blocks/empty-variadic-no-auto-insert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<blocks app="NetsBlox 1.33.3, http://netsblox.org" version="1.33.3"><block-definition collabId="item_0" s="main" type="reporter" category="custom"><header></header><code></code><translations></translations><inputs></inputs><script><block collabId="item_108" s="doDeclareVariables"><list><l>a</l></list></block><block collabId="item_108_1" s="doSetVar"><l>a</l><block collabId="item_108_3" s="reportNewList"><list></list></block></block><custom-block collabId="item_108_2" s="my foreach %upvar in %l %cs"><l>i</l><block collabId="item_108_5" s="reportNumbers"><l>1</l><l>5</l></block><script><block collabId="item_108_6" s="doAddToList"><block collabId="item_142" s="reportNewList"><list><block collabId="item_142_1" s="reportNewList"><list></list></block><block collabId="item_142_2" s="reportConcatenatedLists"><list></list></block><block collabId="item_142_3" s="reportCrossproduct"><list></list></block><custom-block collabId="item_142_4" s="my variadic %mult%n"><list></list></custom-block></list></block><block collabId="item_108_8" var="a"/></block></script></custom-block><block collabId="item_108_4" s="doReport"><block collabId="item_108_9" var="a"/></block></script></block-definition><block-definition collabId="item_52" s="my foreach %&apos;var&apos; in %&apos;list&apos; %&apos;f&apos;" type="command" category="custom"><header></header><code></code><translations></translations><inputs><input type="%upvar"></input><input type="%l"></input><input type="%cs"></input></inputs><script><block collabId="item_58" s="doIf"><block collabId="item_60" s="reportNot"><block collabId="item_59" s="reportListIsEmpty"><block collabId="item_62" var="list"/></block></block><script><block collabId="item_57" s="doFor"><l>i</l><l>1</l><block collabId="item_66" s="reportListAttribute"><l><option>length</option></l><block collabId="item_67" var="list"/></block><script><block collabId="item_70" s="doSetVar"><l>var</l><block collabId="item_72" s="reportListItem"><block collabId="item_73" var="i"/><block collabId="item_74" var="list"/></block></block><block collabId="item_68" s="doRun"><block collabId="item_69" var="f"/><list></list></block></script></block></script></block></script></block-definition><block-definition collabId="item_111" s="my variadic %&apos;vals&apos;" type="reporter" category="custom"><header></header><code></code><translations></translations><inputs><input type="%mult%n"></input></inputs><script><block collabId="item_113" s="doReport"><block collabId="item_114" var="vals"/></block></script></block-definition></blocks>
22 changes: 22 additions & 0 deletions src/test/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,28 @@ fn test_proc_explicit_to_string_cvt() {
});
}

#[test]
fn test_proc_empty_variadic_no_auto_insert() {
let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), UtcOffset::UTC));
let (mut env, _) = get_running_proc(&format!(include_str!("templates/generic-static.xml"),
globals = "",
fields = "",
funcs = include_str!("blocks/empty-variadic-no-auto-insert.xml"),
methods = "",
), Settings::default(), system);

run_till_term(&mut env, |mc, _, res| {
let expect = Value::from_json(mc, json!([
[[], [], [], []],
[[], [], [], []],
[[], [], [], []],
[[], [], [], []],
[[], [], [], []],
])).unwrap();
assert_values_eq(&res.unwrap().0.unwrap(), &expect, 1e-5, "no auto insert");
});
}

#[test]
fn test_proc_signed_zero() {
let system = Rc::new(StdSystem::new_sync(BASE_URL.to_owned(), None, Config::default(), UtcOffset::UTC));
Expand Down

0 comments on commit 5447941

Please sign in to comment.