Index: runtime/observatory/tests/service/dev_fs_test.dart |
diff --git a/runtime/observatory/tests/service/dev_fs_test.dart b/runtime/observatory/tests/service/dev_fs_test.dart |
index 81cf98dfb4fdef28e4b71bc4777d033981302b95..5b2930d775ac521d4bdc8065efe3fe0ad77fca90 100644 |
--- a/runtime/observatory/tests/service/dev_fs_test.dart |
+++ b/runtime/observatory/tests/service/dev_fs_test.dart |
@@ -14,7 +14,9 @@ var tests = [ |
expect(result['type'], equals('FileSystemList')); |
expect(result['fsNames'].toString(), equals("[]")); |
- var params = {'fsName': 'alpha'}; |
+ var params = { |
+ 'fsName': 'alpha' |
+ }; |
result = await vm.invokeRpcNoUpgrade('_createDevFS', params); |
expect(result['type'], equals('FileSystem')); |
expect(result['name'], equals('alpha')); |
@@ -27,8 +29,8 @@ var tests = [ |
bool caughtException; |
try { |
await vm.invokeRpcNoUpgrade('_createDevFS', params); |
- expect(false, isTrue, reason: 'Unreachable'); |
- } on ServerRpcException catch (e) { |
+ expect(false, isTrue, reason:'Unreachable'); |
+ } on ServerRpcException catch(e) { |
caughtException = true; |
expect(e.code, equals(ServerRpcException.kFileSystemAlreadyExists)); |
expect(e.message, "_createDevFS: file system 'alpha' already exists"); |
@@ -45,14 +47,15 @@ var tests = [ |
caughtException = false; |
try { |
await vm.invokeRpcNoUpgrade('_deleteDevFS', params); |
- expect(false, isTrue, reason: 'Unreachable'); |
- } on ServerRpcException catch (e) { |
+ expect(false, isTrue, reason:'Unreachable'); |
+ } on ServerRpcException catch(e) { |
caughtException = true; |
expect(e.code, equals(ServerRpcException.kFileSystemDoesNotExist)); |
expect(e.message, "_deleteDevFS: file system 'alpha' does not exist"); |
} |
expect(caughtException, isTrue); |
}, |
+ |
(VM vm) async { |
var fsId = 'banana'; |
var filePath = '/foo/bar.dat'; |
@@ -60,7 +63,7 @@ var tests = [ |
var result; |
// Create DevFS. |
- result = await vm.invokeRpcNoUpgrade('_createDevFS', {'fsName': fsId}); |
+ result = await vm.invokeRpcNoUpgrade('_createDevFS', { 'fsName': fsId }); |
expect(result['type'], equals('FileSystem')); |
expect(result['name'], equals(fsId)); |
expect(result['uri'], new isInstanceOf<String>()); |
@@ -71,8 +74,8 @@ var tests = [ |
'fsName': fsId, |
'path': filePath, |
}); |
- expect(false, isTrue, reason: 'Unreachable'); |
- } on ServerRpcException catch (e) { |
+ expect(false, isTrue, reason:'Unreachable'); |
+ } on ServerRpcException catch(e) { |
caughtException = true; |
expect(e.code, equals(ServerRpcException.kFileDoesNotExist)); |
expect(e.message, startsWith("_readDevFSFile: FileSystemException: ")); |
@@ -80,22 +83,25 @@ var tests = [ |
expect(caughtException, isTrue); |
// Write a file. |
- result = await vm.invokeRpcNoUpgrade('_writeDevFSFile', |
- {'fsName': fsId, 'path': filePath, 'fileContents': fileContents}); |
+ result = await vm.invokeRpcNoUpgrade('_writeDevFSFile', { |
+ 'fsName': fsId, |
+ 'path': filePath, |
+ 'fileContents': fileContents |
+ }); |
expect(result['type'], equals('Success')); |
// Read the file back. |
result = await vm.invokeRpcNoUpgrade('_readDevFSFile', { |
- 'fsName': fsId, |
- 'path': filePath, |
+ 'fsName': fsId, |
+ 'path': filePath, |
}); |
expect(result['type'], equals('FSFile')); |
expect(result['fileContents'], equals(fileContents)); |
// The leading '/' is optional. |
result = await vm.invokeRpcNoUpgrade('_readDevFSFile', { |
- 'fsName': fsId, |
- 'path': filePath.substring(1), |
+ 'fsName': fsId, |
+ 'path': filePath.substring(1), |
}); |
expect(result['type'], equals('FSFile')); |
expect(result['fileContents'], equals(fileContents)); |
@@ -107,8 +113,8 @@ var tests = [ |
'fsName': fsId, |
'path': '../foo', |
}); |
- expect(false, isTrue, reason: 'Unreachable'); |
- } on ServerRpcException catch (e) { |
+ expect(false, isTrue, reason:'Unreachable'); |
+ } on ServerRpcException catch(e) { |
caughtException = true; |
expect(e.code, equals(ServerRpcException.kInvalidParams)); |
expect(e.message, "_readDevFSFile: invalid 'path' parameter: ../foo"); |
@@ -117,33 +123,33 @@ var tests = [ |
// Write a set of files. |
result = await vm.invokeRpcNoUpgrade('_writeDevFSFiles', { |
- 'fsName': fsId, |
- 'files': [ |
- ['/a', BASE64.encode(UTF8.encode('a_contents'))], |
- ['/b', BASE64.encode(UTF8.encode('b_contents'))] |
- ] |
+ 'fsName': fsId, |
+ 'files': [ |
+ ['/a', BASE64.encode(UTF8.encode('a_contents'))], |
+ ['/b', BASE64.encode(UTF8.encode('b_contents'))] |
+ ] |
}); |
expect(result['type'], equals('Success')); |
// Read one of the files back. |
result = await vm.invokeRpcNoUpgrade('_readDevFSFile', { |
- 'fsName': fsId, |
- 'path': '/b', |
+ 'fsName': fsId, |
+ 'path': '/b', |
}); |
expect(result['type'], equals('FSFile')); |
expect(result['fileContents'], |
- equals(BASE64.encode(UTF8.encode('b_contents')))); |
+ equals(BASE64.encode(UTF8.encode('b_contents')))); |
// List all the files in the file system. |
result = await vm.invokeRpcNoUpgrade('_listDevFSFiles', { |
- 'fsName': fsId, |
+ 'fsName': fsId, |
}); |
expect(result['type'], equals('FSFileList')); |
expect(result['files'].length, equals(3)); |
// Delete DevFS. |
result = await vm.invokeRpcNoUpgrade('_deleteDevFS', { |
- 'fsName': fsId, |
+ 'fsName': fsId, |
}); |
expect(result['type'], equals('Success')); |
}, |