You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
STR:
for element: public Text<_> Text { get; private set; }
assert element with text 123456-1234 using regex:
1: Text.Should.Match("\\d{{6}}-\\d{{4}}");
or
2: Text.Should.Match("\\d{6}-\\d{4}");
Expected behavior:
one of the regex works
Actual behavior:
1: Text.Should.Match("\\d{{6}}-\\d{{4}}");
throws not equal exception
Atata.AssertionException : ---
Expected: should match pattern "\d{6}-\d{4}"
Actual: "123456-1234"
2: Text.Should.Match("\\d{6}-\\d{4}");
System.FormatException : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(String format, Object[] args)
at Atata.IDataVerificationProviderExtensions.BuildVerificationConstraintMessage[TData,TOwner](IDataVerificationProvider2 should, String message, TData[] args) at Atata.IDataVerificationProviderExtensions.Satisfy[TData,TOwner](IDataVerificationProvider2 should, Predicate1 predicate, String message, TData[] args) at Atata.IDataVerificationProviderExtensions.Match[TOwner](IDataVerificationProvider2 should, String pattern)
The text was updated successfully, but these errors were encountered:
The second regex is correct. But I would write it this way: @"^\d{6}-\d{4}$".
However, it is a bug. Match method fails when regex contains "{*}". Exception occurs when the log message is formatting. I will fix it within the next v0.16.0 release of Atata.
For now, you can bypass this issue using common Satisfy method:
YevgeniyShunevych
changed the title
match method fails for regex with curly brackets
Match verification method fails for regex with curly brackets
Nov 16, 2017
STR:
for element:
public Text<_> Text { get; private set; }
assert element with text 123456-1234 using regex:
1:
Text.Should.Match("\\d{{6}}-\\d{{4}}");
or
2:
Text.Should.Match("\\d{6}-\\d{4}");
Expected behavior:
one of the regex works
Actual behavior:
1:
Text.Should.Match("\\d{{6}}-\\d{{4}}");
throws not equal exception
Atata.AssertionException : ---
Expected: should match pattern "\d{6}-\d{4}"
Actual: "123456-1234"
2:
Text.Should.Match("\\d{6}-\\d{4}");
System.FormatException : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(String format, Object[] args)
at Atata.IDataVerificationProviderExtensions.BuildVerificationConstraintMessage[TData,TOwner](IDataVerificationProvider
2 should, String message, TData[] args) at Atata.IDataVerificationProviderExtensions.Satisfy[TData,TOwner](IDataVerificationProvider
2 should, Predicate1 predicate, String message, TData[] args) at Atata.IDataVerificationProviderExtensions.Match[TOwner](IDataVerificationProvider
2 should, String pattern)The text was updated successfully, but these errors were encountered: