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
e6b45c50
Commit
e6b45c50
authored
Sep 11, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use mokito in the init tests
parent
ab441685
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
29 deletions
+26
-29
init.dart
packages/flutter_tools/lib/src/init.dart
+4
-6
init_test.dart
packages/flutter_tools/test/init_test.dart
+8
-16
install_test.dart
packages/flutter_tools/test/install_test.dart
+2
-7
common.dart
packages/flutter_tools/test/src/common.dart
+12
-0
No files found.
packages/flutter_tools/lib/src/init.dart
View file @
e6b45c50
...
...
@@ -65,13 +65,10 @@ Or if the Sky APK is not already on your device, run:
stdout
.
addStream
(
process
.
stdout
);
stderr
.
addStream
(
process
.
stderr
);
int
code
=
await
process
.
exitCode
;
if
(
code
==
0
)
{
print
(
'
\n
${message}
'
);
if
(
code
!=
0
)
return
code
;
}
}
else
{
print
(
message
);
return
2
;
}
return
0
;
}
}
...
...
@@ -146,6 +143,7 @@ name: {{projectName}}
description: {{description}}
dependencies:
sky: any
dev_dependencies:
sky_tools: any
'''
;
...
...
packages/flutter_tools/test/init_test.dart
View file @
e6b45c50
...
...
@@ -4,11 +4,13 @@
import
'dart:io'
;
import
'package:
args/args
.dart'
;
import
'package:
mockito/mockito
.dart'
;
import
'package:path/path.dart'
as
p
;
import
'package:sky_tools/src/init.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
main
()
=>
defineTests
();
defineTests
()
{
...
...
@@ -26,10 +28,11 @@ defineTests() {
// Verify that we create a project that is well-formed.
test
(
'init sky-simple'
,
()
async
{
InitCommandHandler
handler
=
new
InitCommandHandler
();
_MockArgResults
results
=
new
_MockArgResults
();
results
.
values
[
'help'
]
=
false
;
results
.
values
[
'pub'
]
=
true
;
results
.
values
[
'out'
]
=
temp
.
path
;
MockArgResults
results
=
new
MockArgResults
();
when
(
results
[
'help'
]).
thenReturn
(
false
);
when
(
results
[
'pub'
]).
thenReturn
(
true
);
when
(
results
.
wasParsed
(
'out'
)).
thenReturn
(
true
);
when
(
results
[
'out'
]).
thenReturn
(
temp
.
path
);
await
handler
.
processArgResults
(
results
);
String
path
=
p
.
join
(
temp
.
path
,
'lib/main.dart'
);
expect
(
new
File
(
path
).
existsSync
(),
true
);
...
...
@@ -40,14 +43,3 @@ defineTests() {
});
});
}
class
_MockArgResults
implements
ArgResults
{
Map
values
=
{};
operator
[](
String
name
)
=>
values
[
name
];
List
<
String
>
get
arguments
=>
null
;
ArgResults
get
command
=>
null
;
String
get
name
=>
null
;
Iterable
<
String
>
get
options
=>
values
.
keys
;
List
<
String
>
get
rest
=>
null
;
bool
wasParsed
(
String
name
)
=>
values
.
containsKey
(
name
);
}
packages/flutter_tools/test/install_test.dart
View file @
e6b45c50
...
...
@@ -4,11 +4,12 @@
library
install_test
;
import
'package:args/args.dart'
;
import
'package:mockito/mockito.dart'
;
import
'package:sky_tools/src/install.dart'
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
main
()
=>
defineTests
();
defineTests
()
{
...
...
@@ -23,9 +24,3 @@ defineTests() {
});
});
}
@proxy
class
MockArgResults
extends
Mock
implements
ArgResults
{
@override
dynamic
noSuchMethod
(
Invocation
invocation
)
=>
super
.
noSuchMethod
(
invocation
);
}
packages/flutter_tools/test/src/common.dart
0 → 100644
View file @
e6b45c50
// Copyright 2015 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:args/args.dart'
;
import
'package:mockito/mockito.dart'
;
@proxy
class
MockArgResults
extends
Mock
implements
ArgResults
{
@override
dynamic
noSuchMethod
(
Invocation
invocation
)
=>
super
.
noSuchMethod
(
invocation
);
}
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