Make visitor order test more robust

This commit is contained in:
Jeroen Engels 2020-06-25 23:09:09 +02:00
parent c8445f7bf6
commit 1d5ca98a61

View File

@ -21,15 +21,26 @@ all =
rule : Rule
rule =
Rule.newModuleRuleSchema "TestRule" "\n0 - initial context"
|> Rule.withElmJsonModuleVisitor (\_ context -> context ++ "\n1 - withElmJsonModuleVisitor")
|> Rule.withDependenciesModuleVisitor (\_ context -> context ++ "\n2 - withDependenciesModuleVisitor")
|> Rule.withModuleDefinitionVisitor (\_ context -> ( [], context ++ "\n3 - withModuleDefinitionVisitor" ))
|> Rule.withImportVisitor (\_ context -> ( [], context ++ "\n4 - withImportVisitor" ))
|> Rule.withDeclarationListVisitor (\_ context -> ( [], context ++ "\n5 - withDeclarationListVisitor" ))
|> Rule.withDeclarationEnterVisitor (\_ context -> ( [], context ++ "\n6 - withDeclarationEnterVisitor" ))
|> Rule.withDeclarationExitVisitor (\_ context -> ( [], context ++ "\n9 - withDeclarationExitVisitor" ))
|> Rule.withExpressionEnterVisitor (\_ context -> ( [], context ++ "\n7 - withExpressionEnterVisitor" ))
|> Rule.withExpressionExitVisitor (\_ context -> ( [], context ++ "\n8 - withExpressionExitVisitor" ))
|> Rule.withElmJsonModuleVisitor (\_ context -> context ++ "\n1.1 - withElmJsonModuleVisitor")
|> Rule.withElmJsonModuleVisitor (\_ context -> context ++ "\n1.2 - withElmJsonModuleVisitor")
|> Rule.withReadmeModuleVisitor (\_ context -> context ++ "\n2.1 - withReadmeModuleVisitor")
|> Rule.withReadmeModuleVisitor (\_ context -> context ++ "\n2.2 - withReadmeModuleVisitor")
|> Rule.withDependenciesModuleVisitor (\_ context -> context ++ "\n3.1 - withDependenciesModuleVisitor")
|> Rule.withDependenciesModuleVisitor (\_ context -> context ++ "\n3.2 - withDependenciesModuleVisitor")
|> Rule.withModuleDefinitionVisitor (\_ context -> ( [], context ++ "\n4.1 - withModuleDefinitionVisitor" ))
|> Rule.withModuleDefinitionVisitor (\_ context -> ( [], context ++ "\n4.2 - withModuleDefinitionVisitor" ))
|> Rule.withImportVisitor (\_ context -> ( [], context ++ "\n5.1 - withImportVisitor" ))
|> Rule.withImportVisitor (\_ context -> ( [], context ++ "\n5.2 - withImportVisitor" ))
|> Rule.withDeclarationListVisitor (\_ context -> ( [], context ++ "\n6.1 - withDeclarationListVisitor" ))
|> Rule.withDeclarationListVisitor (\_ context -> ( [], context ++ "\n6.2 - withDeclarationListVisitor" ))
|> Rule.withDeclarationEnterVisitor (\_ context -> ( [], context ++ "\n7.1 - withDeclarationEnterVisitor" ))
|> Rule.withDeclarationEnterVisitor (\_ context -> ( [], context ++ "\n7.2 - withDeclarationEnterVisitor" ))
|> Rule.withDeclarationExitVisitor (\_ context -> ( [], context ++ "\n10.2 - withDeclarationExitVisitor" ))
|> Rule.withDeclarationExitVisitor (\_ context -> ( [], context ++ "\n10.1 - withDeclarationExitVisitor" ))
|> Rule.withExpressionEnterVisitor (\_ context -> ( [], context ++ "\n8.1 - withExpressionEnterVisitor" ))
|> Rule.withExpressionEnterVisitor (\_ context -> ( [], context ++ "\n8.2 - withExpressionEnterVisitor" ))
|> Rule.withExpressionExitVisitor (\_ context -> ( [], context ++ "\n9.2 - withExpressionExitVisitor" ))
|> Rule.withExpressionExitVisitor (\_ context -> ( [], context ++ "\n9.1 - withExpressionExitVisitor" ))
|> Rule.withFinalModuleEvaluation finalEvaluation
|> Rule.fromModuleRuleSchema
@ -50,15 +61,26 @@ a = 1
[ Review.Test.error
{ message = """
0 - initial context
1 - withElmJsonModuleVisitor
2 - withDependenciesModuleVisitor
3 - withModuleDefinitionVisitor
4 - withImportVisitor
5 - withDeclarationListVisitor
6 - withDeclarationEnterVisitor
7 - withExpressionEnterVisitor
8 - withExpressionExitVisitor
9 - withDeclarationExitVisitor"""
1.1 - withElmJsonModuleVisitor
1.2 - withElmJsonModuleVisitor
2.1 - withReadmeModuleVisitor
2.2 - withReadmeModuleVisitor
3.1 - withDependenciesModuleVisitor
3.2 - withDependenciesModuleVisitor
4.1 - withModuleDefinitionVisitor
4.2 - withModuleDefinitionVisitor
5.1 - withImportVisitor
5.2 - withImportVisitor
6.1 - withDeclarationListVisitor
6.2 - withDeclarationListVisitor
7.1 - withDeclarationEnterVisitor
7.2 - withDeclarationEnterVisitor
8.1 - withExpressionEnterVisitor
8.2 - withExpressionEnterVisitor
9.1 - withExpressionExitVisitor
9.2 - withExpressionExitVisitor
10.1 - withDeclarationExitVisitor
10.2 - withDeclarationExitVisitor"""
, details = [ "details" ]
, under = "module"
}