From ada5f94967ac6ccc8f9bda299ca461c423c61892 Mon Sep 17 00:00:00 2001
From: Jake Rote <jrote1@users.noreply.github.com>
Date: Mon, 20 Feb 2017 16:05:14 +0000
Subject: [PATCH] Added tab support (#29)

* added tab support

* Formatted code
---
 lib/src/converters/class_converter.dart |  4 ++--
 lib/src/converters/json_converter.dart  |  3 ++-
 pubspec.yaml                            |  4 ++--
 test/all_test.dart                      | 23 +++++++++++++++++++++--
 4 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/lib/src/converters/class_converter.dart b/lib/src/converters/class_converter.dart
index 43d54ad..50bc502 100644
--- a/lib/src/converters/class_converter.dart
+++ b/lib/src/converters/class_converter.dart
@@ -150,8 +150,8 @@ class ClassConverter implements Converter {
       return DateTime.parse(nativeObjectValue);
     }
     if (_isTypeEnum(type)) {
-      return _typeInformationRetriever.getEnumGeneratedMap(type)[
-          nativeObjectValue];
+      return _typeInformationRetriever
+          .getEnumGeneratedMap(type)[nativeObjectValue];
     }
 
     if (type == double && nativeObjectValue != null) {
diff --git a/lib/src/converters/json_converter.dart b/lib/src/converters/json_converter.dart
index 984cb80..75467c6 100644
--- a/lib/src/converters/json_converter.dart
+++ b/lib/src/converters/json_converter.dart
@@ -108,7 +108,8 @@ class JsonConverter implements Converter {
         stringBuffer.write("\"" +
             baseObjectData.value
                 .replaceAll(r"\", r'\\')
-                .replaceAll("\"", '\\"') +
+                .replaceAll("\"", '\\"')
+                .replaceAll("\t", "\\t") +
             "\"");
       else if (baseObjectData.value is DateTime)
         stringBuffer.write('"${baseObjectData.value.toString()}"');
diff --git a/pubspec.yaml b/pubspec.yaml
index 147212f..fa71732 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -11,5 +11,5 @@ dependencies:
   path: '>=1.0.0 <2.0.0'
   reflective: ^0.0.29
 dev_dependencies:
-  test: any
-  transformer_test: any
+  test: 0.12.19+1
+  transformer_test: 0.2.1+1
diff --git a/test/all_test.dart b/test/all_test.dart
index 147573d..74e164e 100644
--- a/test/all_test.dart
+++ b/test/all_test.dart
@@ -1,5 +1,6 @@
 library nomirrorsmap.tests;
 
+import 'dart:io';
 import 'package:test/test.dart';
 import 'package:nomirrorsmap/nomirrorsmap.dart';
 import 'package:nomirrorsmap/nomirrorsmap_mirrors.dart';
@@ -45,6 +46,24 @@ main() async {
           expect(result, "null");
         });
 
+        test("Can serialize with tab", () {
+          var previousJson = noMirrorsMap.convert(
+              new NoTypeTestPropertyClass()
+                ..id = 1
+                ..name = "\t",
+              new ClassConverter(),
+              new JsonConverter());
+          print(previousJson);
+          var result = noMirrorsMap.convert(
+              new NoTypeTestPropertyClass()
+                ..id = 1
+                ..name = previousJson,
+              new ClassConverter(),
+              new JsonConverter());
+
+          expect(result, endsWith('''"name\\":\\"\\\\t\\"}"}'''));
+        });
+
         test("Can serialize to Pascal case", () {
           var result = noMirrorsMap.convert(
               new Person()
@@ -92,8 +111,8 @@ main() async {
         });
 
         test("Can deserialize to object", () {
-          ClassConverter.converters[
-              Duration] = new CustomClassConverter<Duration>()
+          ClassConverter
+              .converters[Duration] = new CustomClassConverter<Duration>()
             ..to = ((ClassIntermediateObject input) {
               return new Duration(
                   minutes: