Merge pull request #849 from Ni-zav/fix/840-extendscript-substr-20261011
fix(script): implement ExtendScript String.substr compatibility # Conflicts: # crates/script/src/tests.rs
This commit is contained in:
@@ -879,3 +879,25 @@ fn script_av_layer_transform_shortcuts_return_live_properties() {
|
||||
let restored = ok(&mut s, "app.project.item(1).layer(1).rotation.numKeys");
|
||||
assert_eq!(restored.result, json!(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn extendscript_substr_keeps_start_and_length_semantics() {
|
||||
let mut s = session();
|
||||
let o = ok(
|
||||
&mut s,
|
||||
r#"[
|
||||
"abcdef".substr(0, 2),
|
||||
"abcdef".substr(2, 3),
|
||||
"abcdef".substr(-2),
|
||||
"abcdef".substr(-20, 2),
|
||||
"abcdef".substr(2, 0),
|
||||
"abcdef".substr(2, -3),
|
||||
"abcdef".substr(2.9, 2.9),
|
||||
"abcdef".substr(3),
|
||||
"abcdef".substr(30, 2),
|
||||
"abcdef".substr(NaN, 2),
|
||||
"abcdef".substr(2, NaN)
|
||||
]"#,
|
||||
);
|
||||
assert_eq!(o.result, json!(["ab", "cde", "ef", "ab", "", "", "cd", "def", "", "ab", ""]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user