@@ -18,21 +18,13 @@ fn test_round_trip() {
1818#[ cfg( all( feature = "serde" , feature = "graphviz" ) ) ]
1919#[ test]
2020fn test_graphviz ( ) {
21- // Check if `dot` command is available
22- let no_dot = std:: process:: Command :: new ( "dot" )
23- . arg ( "-V" )
24- . status ( )
25- . is_err ( ) ;
26-
2721 let mut names = Vec :: new ( ) ;
2822 for entry in test_files ( ) {
2923 println ! ( "Testing graphviz {entry:?}" ) ;
3024 let mut egraph = EGraph :: from_json_file ( entry. as_path ( ) ) . unwrap ( ) ;
3125 names. push ( entry. file_stem ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ) ;
3226
33-
34-
35- egraph. to_dot ( ) ; // Test `to_dot` always
27+ egraph. to_dot ( ) ; // Always test `to_dot`
3628
3729 // Test `to_svg` only when the graphviz-exec feature is available
3830 #[ cfg( feature = "graphviz-exec" ) ]
@@ -50,9 +42,10 @@ fn test_graphviz() {
5042 // Generate graphs with inlined leaves as well
5143 egraph. inline_leaves ( ) ;
5244
53- if no_dot {
54- egraph. to_dot ( ) ;
55- } else {
45+ egraph. to_dot ( ) ;
46+
47+ #[ cfg( feature = "graphviz-exec" ) ]
48+ {
5649 let path = Path :: new ( "./tests-viz" ) . join ( format ! (
5750 "{}-inlined.svg" ,
5851 entry. file_stem( ) . unwrap( ) . to_str( ) . unwrap( )
@@ -67,9 +60,11 @@ fn test_graphviz() {
6760
6861 // Saturate inlining
6962 egraph. saturate_inline_leaves ( ) ;
70- if no_dot {
71- egraph. to_dot ( ) ;
72- } else {
63+
64+ egraph. to_dot ( ) ;
65+
66+ #[ cfg( feature = "graphviz-exec" ) ]
67+ {
7368 let path = Path :: new ( "./tests-viz" ) . join ( format ! (
7469 "{}-inlined-saturated.svg" ,
7570 entry. file_stem( ) . unwrap( ) . to_str( ) . unwrap( )
0 commit comments