Skip to content

Commit 7659e20

Browse files
committed
Failing test for gh-27
1 parent 45f9691 commit 7659e20

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

src/dbgp/client.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,4 +935,71 @@ function call_function(string $hello) {
935935
};
936936
Ok(())
937937
}
938+
939+
#[test]
940+
fn test_parse_multibyte_array() -> Result<(), anyhow::Error> {
941+
let result = parse_xml(
942+
r#"
943+
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="8" context="0">
944+
<property type="array" children="1" numchildren="5" page="0" pagesize="32">
945+
<name encoding="base64"><![CDATA[JGFy8J+YuHJheQ==]]></name>
946+
<fullname encoding="base64"><![CDATA[JGFy8J+YuHJheQ==]]></fullname>
947+
<property type="int">
948+
<name encoding="base64"><![CDATA[aW50]]></name>
949+
<fullname encoding="base64"><![CDATA[JGFy8J+YuHJheVsiaW50Il0=]]></fullname>
950+
<value encoding="base64"><![CDATA[MTIz]]></value>
951+
</property>
952+
</property>
953+
</response>
954+
"#
955+
)?;
956+
957+
match result {
958+
Message::Response(r) => {
959+
match r.command {
960+
CommandResponse::ContextGet(response) => {
961+
let expected = ContextGetResponse {
962+
properties: Properties::from_properties(vec![
963+
Property {
964+
name: "$ar😸ray".to_string(),
965+
fullname: "$ar😸ray".to_string(),
966+
classname: None,
967+
page: Some(0),
968+
pagesize: Some(32),
969+
property_type: PropertyType::Array,
970+
facet: None,
971+
size: None,
972+
children: Properties::from_properties(vec![
973+
Property {
974+
name: "int".to_string(),
975+
fullname: "$ar😸ray[\"int\"]".to_string(),
976+
classname: None,
977+
page: None,
978+
pagesize: None,
979+
property_type: PropertyType::Int,
980+
facet: None,
981+
size: None,
982+
children: Properties::none(),
983+
key: None,
984+
address: None,
985+
encoding: None,
986+
value: Some("1".to_string()),
987+
},
988+
]),
989+
key: None,
990+
address: None,
991+
encoding: None,
992+
value: None,
993+
},
994+
]),
995+
};
996+
assert_eq!(expected, response)
997+
}
998+
_ => panic!("Could not parse context_get"),
999+
};
1000+
}
1001+
_ => panic!("Did not parse"),
1002+
};
1003+
Ok(())
1004+
}
9381005
}

0 commit comments

Comments
 (0)