Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dart.googlesource.com-stagehand
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
dart.googlesource.com-stagehand
Commits
337fb76d
Commit
337fb76d
authored
10 years ago
by
Seth Ladd
Browse files
Options
Downloads
Patches
Plain Diff
add a unittest, clean up lib structure, all dartdoc comments
parent
ad85b9e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/generators/publib.dart
+40
-8
40 additions, 8 deletions
lib/generators/publib.dart
with
40 additions
and
8 deletions
lib/generators/publib.dart
+
40
−
8
View file @
337fb76d
...
...
@@ -21,7 +21,8 @@ class PubLibGenerator extends DefaultGenerator {
addFile
(
'README.md'
,
_readme
);
addFile
(
'example/{{projectName}}.dart'
,
_example
);
setEntrypoint
(
addFile
(
'lib/{{projectName}}.dart'
,
_lib
));
addFile
(
'lib/src/{{projectName}}_impl.dart'
,
_srcLib
);
addFile
(
'lib/src/{{projectName}}_base.dart'
,
_baseLib
);
addFile
(
'test/all_test.dart'
,
_unitTest
);
}
String
get
_pubspec
=
>
'''
...
...
@@ -73,25 +74,29 @@ Please file feature requests and bugs at the [issue tracker][tracker].
// of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
/// The {{projectName}} library.
///
/// This is an awesome library. More dartdocs go here.
library {{projectName}};
import '
src
/
{{
projectName
}}
_impl
.
dart
';
// TODO: Export any libraries intended for clients of this package.
class Awesome {
}
export '
src
/
{{
projectName
}}
_base
.
dart
';
'''
;
String
get
_
src
Lib
=
>
'''
String
get
_
base
Lib
=
>
'''
// Copyright (c)
${new DateTime.now().year}
, the {{projectName}} project
// authors. Please see the AUTHORS file for details. All rights reserved. Use
// of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
library {{projectName}}_impl;
// TODO: Put public facing types in this file.
class DefaultAwesome extends Awesome {
library {{projectName}}.base;
/// Checks if you are awesome. Spoiler: you are.
class Awesome {
bool get isAwesome => true;
}
'''
;
...
...
@@ -107,6 +112,33 @@ import 'package:{{projectName}}/{{projectName}}.dart';
main() {
var awesome = new Awesome();
print(awesome.isAwesome);
}
'''
;
String
get
_unitTest
=
>
'''
// Copyright (c)
${new DateTime.now().year}
, the {{projectName}} project
// authors. Please see the AUTHORS file for details. All rights reserved. Use
// of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
library {{projectName}}.test;
import '
package:
unittest
/
unittest
.
dart
';
import '
package:
{{
projectName
}}
/
{{
projectName
}}
.
dart
';
main() {
group('
A
group
of
tests
', () {
Awesome awesome;
setUp(() {
awesome = new Awesome();
});
test('
First
Test
', () {
expect(awesome.isAwesome, isTrue);
});
});
}
'''
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment