Example #1
0
        public void SimpleGeneratorTest()
        {
            var generator = new SourceMapGenerator();
            var stdin     = "<stdin>";

            generator.AddMapping(new Mapping(stdin, new FilePosition(0, 0), new FilePosition(0, 0)));
            generator.AddMapping(new Mapping(stdin, new FilePosition(0, 1), new FilePosition(1, 0)));
            generator.AddMapping(new Mapping(stdin, new FilePosition(0, 2), new FilePosition(1, 3)));
            generator.AddMapping(new Mapping(stdin, new FilePosition(0, 3), new FilePosition(2, 0)));

            var map = generator.Generate();

            Assert.StartsWith("AAAA;AAAC,GAAC;AAAC", map.mappings);
        }
Example #2
0
        public void DecodeEncodeTest()
        {
            var consumer = new SourceMapConsumer();

            consumer.Parse(SimpleSourceMapObject);

            var generator = new SourceMapGenerator();

            foreach (var m in consumer.Mappings)
            {
                generator.AddMapping(m);
            }
            var map = generator.Generate();

            Assert.Contains("AAAA;AAAC,GAAC;AAAC,GAAC;AAAC,GAAC;AAAC,MAAG,IAAI,EAAC;OAAG;AAAC,SAAK;QAAG,KAAK,EAAC;SAAG;AAAC,WAAK;SAAG;AAAC;;CAAC", map.mappings);
        }