|
| 1 | +using System; |
| 2 | +using MonoDroid.Generation; |
| 3 | +using NUnit.Framework; |
| 4 | + |
| 5 | +namespace generatortests |
| 6 | +{ |
| 7 | + [TestFixture] |
| 8 | + public class CodeGenerationOptionsTests |
| 9 | + { |
| 10 | + [Test] |
| 11 | + public void GetOutputNameUseGlobal () |
| 12 | + { |
| 13 | + var opt = new CodeGenerationOptions { UseGlobal = true }; |
| 14 | + |
| 15 | + Assert.AreEqual (string.Empty, opt.GetOutputName (string.Empty)); |
| 16 | + Assert.AreEqual ("int", opt.GetOutputName ("int")); |
| 17 | + Assert.AreEqual ("void", opt.GetOutputName ("void")); |
| 18 | + Assert.AreEqual ("void", opt.GetOutputName ("System.Void")); |
| 19 | + Assert.AreEqual ("params int[]", opt.GetOutputName ("params int[]")); |
| 20 | + Assert.AreEqual ("params global::System.Object[]", opt.GetOutputName ("params System.Object[]")); |
| 21 | + Assert.AreEqual ("int[][][]", opt.GetOutputName ("int[][][]")); |
| 22 | + Assert.AreEqual ("global::System.Object[][][]", opt.GetOutputName ("System.Object[][][]")); |
| 23 | + |
| 24 | + Assert.AreEqual ("global::System.Collections.Generic.List<string[]>", |
| 25 | + opt.GetOutputName ("System.Collections.Generic.List<string[]>")); |
| 26 | + |
| 27 | + Assert.AreEqual ("global::System.Collections.Generic.Dictionary<string, string>", |
| 28 | + opt.GetOutputName ("System.Collections.Generic.Dictionary<string, string>")); |
| 29 | + |
| 30 | + Assert.AreEqual ("global::System.Collections.Generic.List<global::System.Collections.Generic.List<string>>", |
| 31 | + opt.GetOutputName ("System.Collections.Generic.List<System.Collections.Generic.List<string>>")); |
| 32 | + |
| 33 | + Assert.AreEqual ("global::System.Collections.Generic.List<global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.Dictionary<global::System.Object, global::System.Object>>>", |
| 34 | + opt.GetOutputName ("System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, System.Collections.Generic.Dictionary<System.Object, System.Object>>>")); |
| 35 | + |
| 36 | + Assert.AreEqual ("global::System.Collections.Generic.IList<global::Kotlin.Pair>", |
| 37 | + opt.GetOutputName ("System.Collections.Generic.IList<Kotlin.Pair>")); |
| 38 | + |
| 39 | + Assert.AreEqual ("global::System.Collections.Generic.IDictionary<string, global::System.Collections.Generic.IList<global::Kotlin.Pair>>", |
| 40 | + opt.GetOutputName ("System.Collections.Generic.IDictionary<string, System.Collections.Generic.IList<Kotlin.Pair>>")); |
| 41 | + |
| 42 | + Assert.AreEqual ("global::System.Collections.Generic.IDictionary<global::System.Collections.Generic.IList<string>, global::Kotlin.Pair>", |
| 43 | + opt.GetOutputName ("System.Collections.Generic.IDictionary<System.Collections.Generic.IList<string>, Kotlin.Pair>")); |
| 44 | + |
| 45 | + Assert.AreEqual ("global::System.Collections.Generic.IDictionary<global::System.Collections.Generic.IList<string>, global::System.Collections.Generic.IList<global::Kotlin.Pair>>", |
| 46 | + opt.GetOutputName ("System.Collections.Generic.IDictionary<System.Collections.Generic.IList<string>, System.Collections.Generic.IList<Kotlin.Pair>>")); |
| 47 | + |
| 48 | + Assert.AreEqual ("global::System.Collections.Generic.List<global::System.Collections.Generic.List<string>[]>[]", |
| 49 | + opt.GetOutputName ("System.Collections.Generic.List<System.Collections.Generic.List<string>[]>[]")); |
| 50 | + |
| 51 | + Assert.AreEqual ("global::System.Collections.Generic.List<global::System.Collections.Generic.List<string>.Enumerator[]>", |
| 52 | + opt.GetOutputName ("System.Collections.Generic.List<System.Collections.Generic.List<string>.Enumerator[]>")); |
| 53 | + } |
| 54 | + } |
| 55 | +} |
0 commit comments