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
cb220c85
Commit
cb220c85
authored
Apr 18, 2017
by
Mikkel Nygaard Ravn
Committed by
GitHub
Apr 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test of flutter create --plugin (#9459)
parent
a6a8d997
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
17 deletions
+43
-17
README.md
packages/flutter_tools/README.md
+3
-3
create_test.dart
packages/flutter_tools/test/create_test.dart
+40
-14
No files found.
packages/flutter_tools/README.md
View file @
cb220c85
...
...
@@ -2,9 +2,9 @@
Tools for building Flutter applications.
To run the tests, ensure that no devices are connected and run:
To run the tests, ensure that no devices are connected,
then navigate to
`flutter_tools`
and execute:
```
shell
pub get
FLUTTER_ROOT
=
$PWD
/../.. dart
--checked
test
/all.dart
../../bin/cache/dart-sdk/bin/pub run
test
```
packages/flutter_tools/test/create_test.dart
View file @
cb220c85
...
...
@@ -35,11 +35,27 @@ void main() {
// Verify that we create a project that is well-formed.
testUsingContext
(
'project'
,
()
async
{
return
_createAndAnalyzeProject
(
temp
,
<
String
>[]);
return
_createAndAnalyzeProject
(
temp
,
<
String
>[],
fs
.
path
.
join
(
temp
.
path
,
'lib'
,
'main.dart'
),
);
});
testUsingContext
(
'project with-driver-test'
,
()
async
{
return
_createAndAnalyzeProject
(
temp
,
<
String
>[
'--with-driver-test'
]);
return
_createAndAnalyzeProject
(
temp
,
<
String
>[
'--with-driver-test'
],
fs
.
path
.
join
(
temp
.
path
,
'lib'
,
'main.dart'
),
);
});
testUsingContext
(
'plugin project'
,
()
async
{
return
_createAndAnalyzeProject
(
temp
,
<
String
>[
'--plugin'
],
fs
.
path
.
join
(
temp
.
path
,
'example'
,
'lib'
,
'main.dart'
),
);
});
// Verify content and formatting
...
...
@@ -54,27 +70,30 @@ void main() {
void
expectExists
(
String
relPath
)
{
expect
(
fs
.
isFileSync
(
'
${temp.path}
/
$relPath
'
),
true
);
}
expectExists
(
'lib/main.dart'
);
for
(
FileSystemEntity
file
in
temp
.
listSync
(
recursive:
true
))
{
if
(
file
is
File
&&
file
.
path
.
endsWith
(
'.dart'
))
{
final
String
original
=
file
.
readAsStringSync
();
final
String
original
=
file
.
readAsStringSync
();
final
Process
process
=
await
Process
.
start
(
sdkBinaryName
(
'dartfmt'
),
<
String
>[
file
.
path
],
workingDirectory:
temp
.
path
,
sdkBinaryName
(
'dartfmt'
),
<
String
>[
file
.
path
],
workingDirectory:
temp
.
path
,
);
final
String
formatted
=
await
process
.
stdout
.
transform
(
UTF8
.
decoder
).
join
();
await
process
.
stdout
.
transform
(
UTF8
.
decoder
).
join
();
expect
(
original
,
formatted
,
reason:
file
.
path
);
}
}
// Generated Xcode settings
final
String
xcodeConfigPath
=
fs
.
path
.
join
(
'ios'
,
'Flutter'
,
'Generated.xcconfig'
);
final
String
xcodeConfigPath
=
fs
.
path
.
join
(
'ios'
,
'Flutter'
,
'Generated.xcconfig'
);
expectExists
(
xcodeConfigPath
);
final
File
xcodeConfigFile
=
fs
.
file
(
fs
.
path
.
join
(
temp
.
path
,
xcodeConfigPath
));
final
File
xcodeConfigFile
=
fs
.
file
(
fs
.
path
.
join
(
temp
.
path
,
xcodeConfigPath
));
final
String
xcodeConfig
=
xcodeConfigFile
.
readAsStringSync
();
expect
(
xcodeConfig
,
contains
(
'FLUTTER_ROOT='
));
expect
(
xcodeConfig
,
contains
(
'FLUTTER_APPLICATION_PATH='
));
...
...
@@ -127,7 +146,11 @@ void main() {
});
}
Future
<
Null
>
_createAndAnalyzeProject
(
Directory
dir
,
List
<
String
>
createArgs
)
async
{
Future
<
Null
>
_createAndAnalyzeProject
(
Directory
dir
,
List
<
String
>
createArgs
,
String
mainPath
,
)
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
new
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
...
...
@@ -136,12 +159,15 @@ Future<Null> _createAndAnalyzeProject(Directory dir, List<String> createArgs) as
args
.
add
(
dir
.
path
);
await
runner
.
run
(
args
);
final
String
mainPath
=
fs
.
path
.
join
(
dir
.
path
,
'lib'
,
'main.dart'
);
expect
(
fs
.
file
(
mainPath
).
existsSync
(),
true
);
final
String
flutterToolsPath
=
fs
.
path
.
absolute
(
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
));
final
String
flutterToolsPath
=
fs
.
path
.
absolute
(
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
,
));
final
ProcessResult
exec
=
Process
.
runSync
(
'
$dartSdkPath
/bin/dart'
,
<
String
>[
flutterToolsPath
,
'analyze'
],
workingDirectory:
dir
.
path
'
$dartSdkPath
/bin/dart'
,
<
String
>[
flutterToolsPath
,
'analyze'
],
workingDirectory:
dir
.
path
,
);
if
(
exec
.
exitCode
!=
0
)
{
print
(
exec
.
stdout
);
...
...
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