testFileFunctions function

void testFileFunctions()

A function to test all of the file functions.

Implementation

void testFileFunctions() {
  String shellCommand = 'touch test.json';
  print('Test for the method "runCommand"!');
  runCommand(shellCommand);

  Map<String, dynamic> myData = {'name': 'Alex', 'age': '150'};

  String myJsonString = mapToJSON(myData);
  print('Test for the method "mapToJSON"!');
  print(myJsonString);

  Map<String, dynamic> myJsonMap = getJSONMap(myJsonString);
  print('Test for the method "getJSONMap"!');
  print(myJsonMap);

  print('Test for the method "writeToFile"!');
  writeToFile('test.json', myJsonString);

  print('Test for the method "getFileContents"!');
  print(getFileContents('test.json'));

  print('Test for the method "fileExists"!');
  print(fileExists('test.json'));
}