Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f697f58c
Commit
f697f58c
authored
Apr 07, 2016
by
Yegor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[driver] fix match state hand-off in matcher_util.dart (#3103)
Fixes
https://github.com/flutter/flutter/issues/3094
parent
907215df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
matcher_util.dart
packages/flutter_driver/lib/src/matcher_util.dart
+3
-2
matcher_util_test.dart
packages/flutter_driver/test/src/matcher_util_test.dart
+53
-0
No files found.
packages/flutter_driver/lib/src/matcher_util.dart
View file @
f697f58c
...
@@ -6,11 +6,12 @@ import 'package:matcher/matcher.dart';
...
@@ -6,11 +6,12 @@ import 'package:matcher/matcher.dart';
/// Matches [value] against the [matcher].
/// Matches [value] against the [matcher].
MatchResult
match
(
dynamic
value
,
Matcher
matcher
)
{
MatchResult
match
(
dynamic
value
,
Matcher
matcher
)
{
if
(
matcher
.
matches
(
value
,
{}))
{
Map
<
dynamic
,
dynamic
>
matchState
=
{};
if
(
matcher
.
matches
(
value
,
matchState
))
{
return
new
MatchResult
.
_matched
();
return
new
MatchResult
.
_matched
();
}
else
{
}
else
{
Description
description
=
Description
description
=
matcher
.
describeMismatch
(
value
,
new
_TextDescription
(),
{}
,
false
);
matcher
.
describeMismatch
(
value
,
new
_TextDescription
(),
matchState
,
false
);
return
new
MatchResult
.
_mismatched
(
description
.
toString
());
return
new
MatchResult
.
_mismatched
(
description
.
toString
());
}
}
}
}
...
...
packages/flutter_driver/test/src/matcher_util_test.dart
0 → 100644
View file @
f697f58c
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:test/test.dart'
;
import
'package:flutter_driver/src/matcher_util.dart'
;
void
main
(
)
{
group
(
'match'
,
()
{
test
(
'matches'
,
()
{
_TestMatcher
matcher
=
new
_TestMatcher
(
1
);
MatchResult
ok
=
match
(
1
,
matcher
);
expect
(
ok
.
hasMatched
,
isTrue
);
expect
(
ok
.
mismatchDescription
,
isNull
);
expect
(
matcher
.
matchState1
is
Map
<
dynamic
,
dynamic
>,
isTrue
);
expect
(
matcher
.
matchState2
,
isNull
);
});
test
(
'mismatches'
,
()
{
_TestMatcher
matcher
=
new
_TestMatcher
(
2
);
MatchResult
fail
=
match
(
1
,
matcher
);
expect
(
fail
.
hasMatched
,
isFalse
);
expect
(
fail
.
mismatchDescription
,
'mismatch!'
);
expect
(
matcher
.
matchState1
,
matcher
.
matchState2
);
});
});
}
class
_TestMatcher
extends
Matcher
{
int
expected
;
Map
<
dynamic
,
dynamic
>
matchState1
;
Map
<
dynamic
,
dynamic
>
matchState2
;
_TestMatcher
(
this
.
expected
);
@override
bool
matches
(
dynamic
item
,
Map
<
dynamic
,
dynamic
>
matchState
)
{
matchState1
=
matchState
;
return
item
==
expected
;
}
@override
Description
describeMismatch
(
dynamic
item
,
Description
mismatchDescription
,
Map
<
dynamic
,
dynamic
>
matchState
,
bool
verbose
)
{
matchState2
=
matchState
;
mismatchDescription
.
add
(
'mismatch!'
);
return
mismatchDescription
;
}
@override
Description
describe
(
Description
description
)
{
throw
'not implemented'
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment