diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
commit | 95408b1a41b31b645f3a8c3323ab7d3ca4bff26b (patch) | |
tree | f8f137cddcb9a40499d303be95722fd2c6081bce /main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs | |
parent | b70e4e04b4e41b8ec28d7e4b220b401ecf467e7a (diff) | |
parent | de043d330a8bf5855d4d983c804cd36727cb2406 (diff) |
Merge remote-tracking branch 'origin/roslyn' into new-project-model
Diffstat (limited to 'main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs')
-rw-r--r-- | main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs b/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs index ac7b5d0d40..a0b75b1cd6 100644 --- a/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs +++ b/main/tests/UnitTests/MonoDevelop.SourceEditor/JSonIndentEngineTests.cs @@ -25,18 +25,20 @@ // THE SOFTWARE. using System; using NUnit.Framework; -using MonoDevelop.Ide.CodeCompletion; -using ICSharpCode.NRefactory.CSharp; using System.Text; -using ICSharpCode.NRefactory.Editor; -using MonoDevelop.SourceEditor.JSon; -using Mono.TextEditor; +using MonoDevelop.JSon; +using UnitTests; +using ICSharpCode.NRefactory6.CSharp; +using MonoDevelop.CSharpBinding; +using MonoDevelop.CSharpBinding.Tests; namespace MonoDevelop.SourceEditor { [TestFixture] - public class JSonIndentEngineTests + public class JSonIndentEngineTests : TestBase { + const string indentString = " "; + public static IDocumentIndentEngine CreateEngine (string text) { var sb = new StringBuilder (); @@ -50,11 +52,18 @@ namespace MonoDevelop.SourceEditor sb.Append (ch); } - var data = new TextEditorData (); - data.Text = sb.ToString (); - var csi = new JSonIndentEngine (data); + var tww = new TestWorkbenchWindow (); + var content = new TestViewContent (); + tww.ViewContent = content; + content.ContentName = "/a.json"; + content.Data.MimeType = "application/json"; + + content.Data.Text = sb.ToString (); + var doc = new MonoDevelop.Ide.Gui.Document (tww); + + var csi = new JSonIndentEngine (content.Data, doc); var result = new CacheIndentEngine (csi); - result.Update (offset); + result.Update (content.Data, offset); return result; } @@ -66,8 +75,8 @@ namespace MonoDevelop.SourceEditor { $ "); - Assert.AreEqual ("\t", engine.ThisLineIndent); - Assert.AreEqual ("\t", engine.NextLineIndent); + Assert.AreEqual (indentString, engine.ThisLineIndent); + Assert.AreEqual (indentString, engine.NextLineIndent); } [Test] @@ -79,8 +88,8 @@ $ ""foo"":""bar"", $ "); - Assert.AreEqual ("\t", engine.ThisLineIndent); - Assert.AreEqual ("\t", engine.NextLineIndent); + Assert.AreEqual (indentString, engine.ThisLineIndent); + Assert.AreEqual (indentString, engine.NextLineIndent); } [Test] @@ -92,16 +101,16 @@ $ ""test"":[ $ "); - Assert.AreEqual ("\t\t", engine.ThisLineIndent); - Assert.AreEqual ("\t\t", engine.NextLineIndent); + Assert.AreEqual (indentString + indentString, engine.ThisLineIndent); + Assert.AreEqual (indentString + indentString, engine.NextLineIndent); } [Test] public void TestWindowsEOL () { var engine = CreateEngine ("\r\n{\r\n$\r\n"); - Assert.AreEqual ("\t", engine.ThisLineIndent); - Assert.AreEqual ("\t", engine.NextLineIndent); + Assert.AreEqual (indentString, engine.ThisLineIndent); + Assert.AreEqual (indentString, engine.NextLineIndent); } } } |