Skip to content

Commit ce875ee

Browse files
committedJan 4, 2025·
BlockPrototype: Add support for %n args
Resolves: #616
·
v0.13.3v0.13.0
1 parent ba66d94 commit ce875ee

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

‎src/scratch/blockprototype_p.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ void BlockPrototypePrivate::setProcCode(const std::string &newProcCode)
2727
arg = false;
2828
switch (c) {
2929
case 's':
30+
case 'n':
3031
argumentDefaults.push_back("");
3132
argumentTypes.push_back(BlockPrototype::ArgType::StringNum);
3233
break;

‎test/scratch_classes/blockprototype_test.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ TEST(BlockPrototypeTest, Constructors)
1717
ASSERT_TRUE(p2.argumentDefaults().empty());
1818
ASSERT_FALSE(p2.warp());
1919

20-
BlockPrototype p3("test %s block %s %b");
21-
ASSERT_EQ(p3.procCode(), "test %s block %s %b");
20+
BlockPrototype p3("test %s block %s %b test %n");
21+
ASSERT_EQ(p3.procCode(), "test %s block %s %b test %n");
2222
ASSERT_EQ(
2323
p3.argumentTypes(),
2424
std::vector<BlockPrototype::ArgType>({
2525
BlockPrototype::ArgType::StringNum,
2626
BlockPrototype::ArgType::StringNum,
2727
BlockPrototype::ArgType::Bool,
28+
BlockPrototype::ArgType::StringNum,
2829
}));
29-
ASSERT_EQ(p3.argumentDefaults(), std::vector<Value>({ "", "", false }));
30+
ASSERT_EQ(p3.argumentDefaults(), std::vector<Value>({ "", "", false, "" }));
3031
ASSERT_FALSE(p3.warp());
3132
}
3233

0 commit comments

Comments
 (0)
Please sign in to comment.