incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric THOMAS (JIRA) <j...@apache.org>
Subject [jira] [Commented] (FLEX-33242) Mustella tests failed: when your computer language doesn't match the expected localized error
Date Sun, 11 Nov 2012 14:25:13 GMT

    [ https://issues.apache.org/jira/browse/FLEX-33242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494882#comment-13494882
] 

Frédéric THOMAS commented on FLEX-33242:
----------------------------------------

What I had to do basicly, was to create a ValueArray class to not break the tests where Array
where really used, the the essensial of the implementation is this one :

package {
    public class ValueArray {
        private var _parts:Array;

        public function ValueArray(parts:Array) {
            _parts = parts;
        }

        public function get parts():Array {
            return _parts;
        }
    }
}

In Assert :



	/**
	 *  convert everything to strings (like null)
	 */
	protected function valueToString(value:*):String
	{
		if (value == null)
			return "null";
		var s:String;

		if (value is Number)
		{
			if ((value is int) || (value is uint))
				s = value.toString();
			else
				s = value.toFixed(6);
		}

        else if (value is ValueArray) // added a specific test here
            s = ValueArray(value).parts.join('"..."') + '"';
		else
			s = value.toString();

		if (s == "[object Object]")
			s = ObjectUtil.toString(value, null, excludeList);
		return s;
	}

    protected function contains(value:*, expectedError:ValueArray):Boolean {
        if (expectedError && expectedError.parts && expectedError.parts.length)
            for (var i:uint = 0; i < expectedError.parts.length; i++) {
                if (valueToString(value).indexOf(valueToString(expectedError.parts[i])) ==
-1)
                    return false;
            }

        return true;
    }

in the doStep method AssertError, AssertPropertyValue and AssertMethodValue, if the value
type is ValueArray, the check uses the contains method and the doFail output is adapted.

The use of this test methods looks like that now in case of checking for errors:

<AssertError value="{new ValueArray(['ReferenceError: Error #1074:', 'country', 'mx.resources.Locale'])}"/>
                
> Mustella tests failed: when your computer language doesn't match the expected localized
error
> ---------------------------------------------------------------------------------------------
>
>                 Key: FLEX-33242
>                 URL: https://issues.apache.org/jira/browse/FLEX-33242
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Mustella
>    Affects Versions: Apache Flex 4.9.0
>            Reporter: Frédéric THOMAS
>            Priority: Critical
>              Labels: test
>         Attachments: FLEX-33242.patch
>
>
> Mustella tests fail when your computer language doesn't match the expected localized
error

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message