add more complex normalization test & fix normalization of application arguments
This commit is contained in:
parent
7b22bdc170
commit
3014213aa7
2 changed files with 11 additions and 1 deletions
|
@ -41,7 +41,7 @@ impl TypeTerm {
|
||||||
new_ladder.push( TypeTerm::App(vec![]) );
|
new_ladder.push( TypeTerm::App(vec![]) );
|
||||||
|
|
||||||
for arg in args_iter {
|
for arg in args_iter {
|
||||||
match arg.clone() {
|
match arg.normalize() {
|
||||||
TypeTerm::Ladder(rungs) => {
|
TypeTerm::Ladder(rungs) => {
|
||||||
// duplicate last element for each rung
|
// duplicate last element for each rung
|
||||||
let l = new_ladder.len();
|
let l = new_ladder.len();
|
||||||
|
|
|
@ -43,5 +43,15 @@ fn test_normalize() {
|
||||||
dict.parse("<Seq <Digit 10>~Char>").expect("parse error").normalize(),
|
dict.parse("<Seq <Digit 10>~Char>").expect("parse error").normalize(),
|
||||||
dict.parse("<Seq <Digit 10>>~<Seq Char>").expect("parse errror"),
|
dict.parse("<Seq <Digit 10>>~<Seq Char>").expect("parse errror"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
dict.parse("<A <B C~D~E> F~G H H>").expect("parse error").normalize(),
|
||||||
|
dict.parse("<A <B C> F H H>
|
||||||
|
~<A <B D> F H H>
|
||||||
|
~<A <B E> F H H>
|
||||||
|
~<A <B E> G H H>").expect("parse errror"),
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue