blob: c20d176d8fbb61e4f544a26cf6c1c8c51e9b6aa0 [file] [log] [blame]
IDL union types unittests
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Tests for attributes
PASS unionTypesTest.doubleOrStringOrStringSequenceAttribute is 0
PASS unionTypesTest.doubleOrStringOrStringSequenceAttribute is 3.14
PASS unionTypesTest.doubleOrStringOrStringSequenceAttribute is "foo"
PASS unionTypesTest.doubleOrStringOrStringSequenceAttribute is "undefined"
PASS unionTypesTest.doubleOrStringOrStringSequenceAttribute is "null"
PASS unionTypesTest.doubleOrStringOrStringSequenceAttribute is "[object Object]"
PASS JSON.stringify(unionTypesTest.doubleOrStringOrStringSequenceAttribute) is "[]"
PASS JSON.stringify(unionTypesTest.doubleOrStringOrStringSequenceAttribute) is "[\"a\",\"3.14\"]"
Tests for method arguments
PASS unionTypesTest.doubleOrStringArg(3.14) is "double is passed: 3.14"
PASS unionTypesTest.doubleOrStringArg("foo") is "string is passed: foo"
PASS unionTypesTest.doubleOrStringArg(undefined) is "string is passed: undefined"
PASS unionTypesTest.doubleOrStringArg(null) is "string is passed: null"
PASS unionTypesTest.doubleOrStringArg({}) is "string is passed: [object Object]"
PASS unionTypesTest.doubleOrStringArg([]) is "string is passed: "
PASS typeof unionTypesTest.doubleOrStringArg(new Date) is "string"
PASS unionTypesTest.doubleOrStringArg() threw exception TypeError: Failed to execute 'doubleOrStringArg' on 'UnionTypesTest': 1 argument required, but only 0 present..
PASS unionTypesTest.doubleOrInternalEnumArg(3.14) is "double is passed: 3.14"
PASS unionTypesTest.doubleOrInternalEnumArg("foo") is "InternalEnum is passed: foo"
PASS unionTypesTest.doubleOrInternalEnumArg("invalid") threw exception TypeError: Failed to execute 'doubleOrInternalEnumArg' on 'UnionTypesTest': The provided value 'invalid' is not a valid enum value of type InternalEnum..
PASS unionTypesTest.doubleOrInternalEnumArg(null) threw exception TypeError: Failed to execute 'doubleOrInternalEnumArg' on 'UnionTypesTest': The provided value 'null' is not a valid enum value of type InternalEnum..
PASS unionTypesTest.doubleOrInternalEnumArg({}) threw exception TypeError: Failed to execute 'doubleOrInternalEnumArg' on 'UnionTypesTest': The provided value '[object Object]' is not a valid enum value of type InternalEnum..
PASS unionTypesTest.doubleOrInternalEnumArg([]) threw exception TypeError: Failed to execute 'doubleOrInternalEnumArg' on 'UnionTypesTest': The provided value '' is not a valid enum value of type InternalEnum..
PASS unionTypesTest.doubleOrStringSequenceArg([]) is ""
PASS unionTypesTest.doubleOrStringSequenceArg([3.14, "foo"]) is "double: 3.14, string: foo"
PASS unionTypesTest.doubleOrStringSequenceArg([1, "foo", "bar", 2]) is "double: 1, string: foo, string: bar, double: 2"
PASS unionTypesTest.doubleOrStringSequenceArg([null, undefined, {}, []]) is "string: null, string: undefined, string: [object Object], string: "
PASS unionTypesTest.doubleOrStringSequenceArg(null) threw exception TypeError: Failed to execute 'doubleOrStringSequenceArg' on 'UnionTypesTest': The provided value cannot be converted to a sequence..
PASS unionTypesTest.doubleOrStringSequenceArg(undefined) threw exception TypeError: Failed to execute 'doubleOrStringSequenceArg' on 'UnionTypesTest': The provided value cannot be converted to a sequence..
PASS unionTypesTest.doubleOrStringSequenceArg({}) threw exception TypeError: Failed to execute 'doubleOrStringSequenceArg' on 'UnionTypesTest': Iterator getter is not callable..
Tests for method arguments with defaults
PASS unionTypesTest.doubleOrStringDefaultDoubleArg() is "double is passed: 3.14"
PASS unionTypesTest.doubleOrStringDefaultDoubleArg(undefined) is "double is passed: 3.14"
PASS unionTypesTest.doubleOrStringDefaultDoubleArg("foo") is "string is passed: foo"
PASS unionTypesTest.doubleOrStringDefaultStringArg() is "string is passed: foo"
PASS unionTypesTest.doubleOrStringDefaultStringArg(undefined) is "string is passed: foo"
PASS unionTypesTest.doubleOrStringDefaultStringArg(3.14) is "double is passed: 3.14"
PASS unionTypesTest.doubleOrStringDefaultNullArg() is "null is passed"
PASS unionTypesTest.doubleOrStringDefaultNullArg(undefined) is "null is passed"
PASS unionTypesTest.doubleOrStringDefaultNullArg(null) is "null is passed"
PASS unionTypesTest.doubleOrStringDefaultNullArg(3.14) is "double is passed: 3.14"
PASS unionTypesTest.doubleOrStringDefaultNullArg("foo") is "string is passed: foo"
Tests for nullable method arguments
PASS unionTypesTest.nodeListOrElementOrNullArg(undefined) is "null or undefined is passed"
PASS unionTypesTest.nodeListOrElementOrNullArg(null) is "null or undefined is passed"
PASS unionTypesTest.nodeListOrElementOrNullArg(nodeList) is "nodelist is passed"
PASS unionTypesTest.nodeListOrElementOrNullArg(element) is "element is passed"
PASS unionTypesTest.nodeListOrElementOrNullArg(3.14) threw exception TypeError: Failed to execute 'nodeListOrElementOrNullArg' on 'UnionTypesTest': The provided value is not of type '(NodeList or Element)'.
PASS unionTypesTest.nodeListOrElementOrNullArg("foo") threw exception TypeError: Failed to execute 'nodeListOrElementOrNullArg' on 'UnionTypesTest': The provided value is not of type '(NodeList or Element)'.
PASS unionTypesTest.nodeListOrElementOrNullArg({}) threw exception TypeError: Failed to execute 'nodeListOrElementOrNullArg' on 'UnionTypesTest': The provided value is not of type '(NodeList or Element)'.
PASS unionTypesTest.nodeListOrElementOrNullArg([]) threw exception TypeError: Failed to execute 'nodeListOrElementOrNullArg' on 'UnionTypesTest': The provided value is not of type '(NodeList or Element)'.
PASS unionTypesTest.nodeListOrElementArg(undefined) threw exception TypeError: Failed to execute 'nodeListOrElementArg' on 'UnionTypesTest': The provided value is not of type '(NodeList or Element)'.
PASS unionTypesTest.nodeListOrElementArg(null) threw exception TypeError: Failed to execute 'nodeListOrElementArg' on 'UnionTypesTest': The provided value is not of type '(NodeList or Element)'.
PASS unionTypesTest.nodeListOrElementArg(nodeList) is "nodelist is passed"
PASS unionTypesTest.nodeListOrElementArg(element) is "element is passed"
Tests for method arguments with sequence members
PASS unionTypesTest.doubleOrStringOrStringSequenceArg() threw exception TypeError: Failed to execute 'doubleOrStringOrStringSequenceArg' on 'UnionTypesTest': 1 argument required, but only 0 present..
PASS unionTypesTest.doubleOrStringOrStringSequenceArg("abc") is "string: abc"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg(3.14) is "double: 3.14"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg(true) is "string: true"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg(null) is "string: null"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg(undefined) is "string: undefined"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg([]) is "sequence: []"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg(["a", 3.14]) is "sequence: [a, 3.14]"
PASS unionTypesTest.doubleOrStringOrStringSequenceArg(new Array(3)) is "sequence: [undefined, undefined, undefined]"
Tests for nullable method arguments with sequence members
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg() threw exception TypeError: Failed to execute 'doubleOrStringOrStringSequenceNullableArg' on 'UnionTypesTest': 1 argument required, but only 0 present..
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg("abc") is "string: abc"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg(3.14) is "double: 3.14"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg(true) is "string: true"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg(null) is "null"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg(undefined) is "null"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg([]) is "sequence: []"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg(["a", 3.14]) is "sequence: [a, 3.14]"
PASS unionTypesTest.doubleOrStringOrStringSequenceNullableArg(new Array(3)) is "sequence: [undefined, undefined, undefined]"
PASS successfullyParsed is true
TEST COMPLETE