mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
codegen: add tests for non-nullable non-required values
This commit is contained in:
parent
92ba0b9c39
commit
093f5c01e4
3 changed files with 16 additions and 6 deletions
|
@ -347,11 +347,15 @@ impl TestBindingMethods for TestBinding {
|
|||
unsignedLongValue: None,
|
||||
unsignedShortValue: None,
|
||||
usvstringValue: None,
|
||||
nonRequiredNullable: None,
|
||||
nonRequiredNullable2: Some(None), // null
|
||||
}
|
||||
}
|
||||
|
||||
fn TypeKeywordIsSuccess(&self, arg: &TestDictionary) -> bool {
|
||||
arg.type_.as_ref().map(|s| s == "success").unwrap_or(false)
|
||||
fn DictMatchesPassedValues(&self, arg: &TestDictionary) -> bool {
|
||||
arg.type_.as_ref().map(|s| s == "success").unwrap_or(false) &&
|
||||
arg.nonRequiredNullable.is_none() &&
|
||||
arg.nonRequiredNullable2 == Some(None)
|
||||
}
|
||||
|
||||
fn PassBoolean(&self, _: bool) {}
|
||||
|
|
|
@ -32,6 +32,11 @@ dictionary TestDictionary {
|
|||
sequence<TestDictionaryDefaults> seqDict;
|
||||
// Reserved rust keyword
|
||||
DOMString type;
|
||||
// These are used to test bidirectional conversion
|
||||
// and differentiation of non-required and nullable types
|
||||
// in dictionaries.
|
||||
DOMString? nonRequiredNullable;
|
||||
DOMString? nonRequiredNullable2;
|
||||
};
|
||||
|
||||
dictionary TestDictionaryDefaults {
|
||||
|
@ -199,7 +204,7 @@ interface TestBinding {
|
|||
(unsigned long or boolean)? receiveNullableUnion5();
|
||||
sequence<long>? receiveNullableSequence();
|
||||
TestDictionary receiveTestDictionaryWithSuccessOnKeyword();
|
||||
boolean typeKeywordIsSuccess(TestDictionary arg);
|
||||
boolean dictMatchesPassedValues(TestDictionary arg);
|
||||
|
||||
void passBoolean(boolean arg);
|
||||
void passByte(byte arg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue