This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
56 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ dev_dependencies: | |
browser: ^0.10.0 | ||
ghpages_generator: ^0.2.4 | ||
grinder: ^0.7.0 | ||
unittest: ^0.11.0 | ||
test: ^0.12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) 2014, Google Inc. 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 stagehand.mock_test; | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:stagehand/stagehand.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
for (var generator in generators) { | ||
test(generator.id, () => _testGenerator(getGenerator(generator.id))); | ||
} | ||
} | ||
|
||
Future _testGenerator(Generator generator) async { | ||
expect(generator.id, isNotNull); | ||
|
||
MockTarget target = new MockTarget(); | ||
|
||
// Assert that we can generate the template. | ||
await generator.generate('foo', target); | ||
|
||
// Run some basic validation on the generated results. | ||
expect(target.getFileContentsAsString('.gitignore'), isNotNull); | ||
expect(target.getFileContentsAsString('pubspec.yaml'), isNotNull); | ||
} | ||
|
||
class MockTarget extends GeneratorTarget { | ||
Map<String, List<int>> files = {}; | ||
|
||
Future createFile(String path, List<int> contents) { | ||
files[path] = contents; | ||
return new Future.value(); | ||
} | ||
|
||
bool hasFile(String path) => files.containsKey(path); | ||
|
||
String getFileContentsAsString(String path) { | ||
if (!hasFile(path)) return null; | ||
return new String.fromCharCodes(files[path]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.