marijnh/tern — pull request #263 by sqs (2013-12-17 03:30:15+00:00)
Title: Test that condensation and loading defs preserves the defs

This PR adds an additional step to the condense tests: reloading the condensed defs and checking to make sure they are equal to the defs that were constructed in memory. The goal of this test is to ensure that condensing and reloading defs doesn't lose information.

Currently, 5 condense test cases fail this test:

```
$ bin/test
condense/add_to_old: Mismatch in condense output after loading defs. Got {
"!name": "add_to_old",
"Thing": {
"!span": "9[0:9]-14[0:14]",
"!type": "fn()"
}
}
Expected {
"!name": "add_to_old",
"Element": {
"prototype": {
"foo": {
"!span": "39[2:18]-42[2:21]",
"!type": "+Thing"
}
}
},
"Thing": {
"!span": "9[0:9]-14[0:14]",
"!type": "fn()"
}
}
condense/ref_in_type: Mismatch in condense output after loading defs. Got {
"!name": "ref_in_type",
"out": {
"!span": "9[0:9]-12[0:12]",
"!type": "fn(a: ?) -> number"
}
}
Expected {
"!name": "ref_in_type",
"!define": {
"out.!0": {
"!span": "13[0:13]-14[0:14]",
"bar": {
"!span": "78[3:24]-81[3:27]",
"!type": "number"
}
}
},
"out": {
"!span": "9[0:9]-12[0:12]",
"!type": "fn(a: ?) -> number"
}
}
condense/generic: Mismatch in condense output after loading defs. Got {
"!name": "generic",
"x": {
"!span": "9[0:9]-10[0:10]",
"!type": "fn(y: ?)"
}
}
Expected {
"!name": "generic",
"x": {
"!span": "9[0:9]-10[0:10]",
"!type": "fn(y: ?) -> !0.bar"
}
}
condense/node_fn_export: Mismatch in condense output after loading defs. Got {
"!name": "node_fn_export",
"!define": {
"!node": {
"node_fn_export": {
"!span": "17[0:17]-42[0:42]",
"!type": "fn(a: ?)"
}
}
}
}
Expected {
"!name": "node_fn_export",
"!define": {
"!node": {
"node_fn_export": {
"!span": "17[0:17]-42[0:42]",
"!type": "fn(a: ?) -> !0"
}
}
}
}
condense/angular_simple: Mismatch in condense output after loading defs. Got {
"!name": "angular_simple"
}
Expected {
"!name": "angular_simple",
"!define": {
"!ng": {
"foo": {
"!data": {
"includes": []
},
"!proto": "angular.Module.prototype",
"_inject_fooVal": {
"!span": "32[0:32]-40[0:40]"
}
},
"test": {
"!data": {
"includes": [
"foo"
]
},
"!proto": "angular.Module.prototype",
"_inject_testVal": {
"!doc": "Doc for testVal",
"!span": "121[4:9]-130[4:18]",
"!type": "string"
}
}
}
}
}
Ran 367 tests from 59 files.
5 failures!
```