Skip to content

Commit

Permalink
Add a test that non-optional after optional works
Browse files Browse the repository at this point in the history
Summary: In D57151706 we check it passes. Now check it works at evaluation time too.

Reviewed By: stepancheg

Differential Revision: D57160402

fbshipit-source-id: 300ad53f423f891bd270cf20acf492eb0098110a
  • Loading branch information
ndmitchell authored and facebook-github-bot committed May 9, 2024
1 parent 71bb77a commit b081c57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions starlark/src/tests/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,18 @@ noop(f)(1)
);
}

#[test]
fn test_non_optional_after_optional() {
assert::pass(
r#"
def f(*args, x, y = 42, z):
return (args, x, y, z)
assert_eq(f(x = 1, z = 3), ((), 1, 42, 3))
assert_eq(f(2, 4, y = 7, x = 1, z = 3), ((2, 4), 1, 7, 3))
"#,
);
}

// This test relies on stack behavior which does not hold when
// ASAN is enabled. See D47571173 for more context.
#[cfg_attr(rust_nightly, cfg(not(sanitize = "address")))]
Expand Down

0 comments on commit b081c57

Please sign in to comment.