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
1d8117e2
Commit
1d8117e2
authored
Mar 11, 2016
by
Ian Hickson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2625 from Hixie/conflictingNamePattern
flutter analyze test
parents
15f6480b
e6b82b6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+5
-1
analyze_duplicate_names_test.dart
...ages/flutter_tools/test/analyze_duplicate_names_test.dart
+48
-0
drive_test.dart
packages/flutter_tools/test/drive_test.dart
+3
-2
No files found.
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
1d8117e2
...
...
@@ -150,13 +150,17 @@ class FlutterCommandRunner extends CommandRunner {
if
(
Platform
.
environment
.
containsKey
(
kFlutterRootEnvironmentVariableName
))
return
Platform
.
environment
[
kFlutterRootEnvironmentVariableName
];
try
{
if
(
Platform
.
script
.
scheme
==
'data'
)
return
'../..'
;
// we're running as a test
String
script
=
Platform
.
script
.
toFilePath
();
if
(
path
.
basename
(
script
)
==
kSnapshotFileName
)
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
script
)));
if
(
path
.
basename
(
script
)
==
kFlutterToolsScriptFileName
)
return
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
path
.
dirname
(
script
))));
}
catch
(
error
)
{
printTrace
(
'Unable to locate fluter root:
$error
'
);
// we don't have a logger at the time this is run
// (which is why we don't use printTrace here)
print
(
'Unable to locate flutter root:
$error
'
);
}
return
'.'
;
}
...
...
packages/flutter_tools/test/analyze_duplicate_names_test.dart
0 → 100644
View file @
1d8117e2
// 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
'dart:io'
;
import
'package:flutter_tools/src/base/os.dart'
;
import
'package:flutter_tools/src/commands/analyze.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:test/test.dart'
;
import
'src/common.dart'
;
import
'src/context.dart'
;
import
'src/mocks.dart'
;
void
main
(
)
{
Directory
tempDir
;
setUp
(()
{
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'analysis_duplicate_names_test'
);
});
tearDown
(()
{
tempDir
?.
deleteSync
(
recursive:
true
);
});
group
(
'analyze'
,
()
{
testUsingContext
(
'flutter analyze with two files with the same name'
,
()
async
{
File
dartFileA
=
new
File
(
path
.
join
(
tempDir
.
path
,
'a.dart'
));
dartFileA
.
parent
.
createSync
();
dartFileA
.
writeAsStringSync
(
'library test;'
);
File
dartFileB
=
new
File
(
path
.
join
(
tempDir
.
path
,
'b.dart'
));
dartFileB
.
writeAsStringSync
(
'library test;'
);
AnalyzeCommand
command
=
new
AnalyzeCommand
();
applyMocksToCommand
(
command
);
return
createTestCommandRunner
(
command
).
run
([
'analyze'
,
'--no-current-package'
,
'--no-current-directory'
,
dartFileA
.
path
,
dartFileB
.
path
]).
then
((
int
code
)
{
expect
(
code
,
equals
(
1
));
expect
(
testLogger
.
errorText
,
'[warning] The imported libraries
\'
a.dart
\'
and
\'
b.dart
\'
cannot have the same name
\'
test
\'
(
${dartFileB.path}
)
\n
'
);
expect
(
testLogger
.
statusText
,
'Analyzing 2 entry points...
\n
'
);
});
},
overrides:
<
Type
,
dynamic
>{
OperatingSystemUtils:
os
});
});
}
packages/flutter_tools/test/drive_test.dart
View file @
1d8117e2
...
...
@@ -68,8 +68,9 @@ void main() {
return
createTestCommandRunner
(
command
).
run
(
args
).
then
((
int
code
)
{
expect
(
code
,
equals
(
1
));
BufferLogger
buffer
=
logger
;
expect
(
buffer
.
errorText
,
contains
(
'Test file not found: /some/app/test_driver/e2e_test.dart'
));
expect
(
buffer
.
errorText
,
contains
(
'Test file not found: /some/app/test_driver/e2e_test.dart'
));
});
});
...
...
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