@@ -355,15 +355,20 @@ def main():
355355
356356 ## Step 2: Walk and print
357357 # Uncomment when you get to step 2
358- # step2_walk_print(original_ast)
358+ # step2_walk_print(original_ast)
359359
360360 ## Step 3: Unparse
361361 # Uncomment when you get to step 3
362- # step3_unparse(original_ast)
362+ # step3_unparse(original_ast)
363363
364364 ## Step 4: Feature counter
365365 # Uncomment when you get to step 4
366- # step4_subshells(original_ast)
366+ # step4_subshells(original_ast)
367+
368+ # Uncomment when you get to step 4
369+ # subshell_test = step1_parse_script("sh/subshells.sh")
370+ # subshell_count = step4_subshells(subshell_test)
371+ # assert subshell_count in [4, 5], "subshell counting is not correct"
367372
368373 # Uncomment when you get to step 4
369374 # subshell_test = step1_parse_script("sh/subshells.sh")
@@ -374,34 +379,34 @@ def main():
374379
375380 # tests for is_effect_free
376381 # Uncomment when you get to step 5
377- # ef_test = step1_parse_script("sh/effectful.sh")
378- # for (node, _, _, _) in ef_test:
379- # pretty = node.pretty()
380- # safe = is_effect_free(node)
381- # assert safe == ("I am not effectful" in pretty)
382- # print("🎉 CONGRATULATIONS! YOU WROTE YOUR FIRST SHELL ANALYSIS!!!!! 🎉")
382+ # ef_test = step1_parse_script("sh/effectful.sh")
383+ # for (node, _, _, _) in ef_test:
384+ # pretty = node.pretty()
385+ # safe = is_effect_free(node)
386+ # assert safe == ("I am not effectful" in pretty)
387+ # print("🎉 CONGRATULATIONS! YOU WROTE YOUR FIRST SHELL ANALYSIS!!!!! 🎉")
383388
384- # step5_effect_free(original_ast)
389+ # step5_effect_free(original_ast)
385390
386391 ## Part 2
387392
388393 ## Step 6: Preprocess and print each command
389394 # Uncomment when you get to step 6
390- # preprocessed_script = step6_stubs(original_ast)
391- # with open(f"{input_script}.preprocessed.1", "w", encoding="utf-8") as out_file:
392- # print(preprocessed_script, file=out_file)
395+ # preprocessed_script = step6_stubs(original_ast)
396+ # with open(f"{input_script}.preprocessed.1", "w", encoding="utf-8") as out_file:
397+ # print(preprocessed_script, file=out_file)
393398
394399 ## Step 7: Preprocess using the JIT
395400 # Uncomment when you get to step 7
396- # preprocessed_script = step7_debug_jit(original_ast)
397- # with open(f"{input_script}.preprocessed.2", "w", encoding="utf-8") as out_file:
398- # print(preprocessed_script, file=out_file)
401+ # preprocessed_script = step7_debug_jit(original_ast)
402+ # with open(f"{input_script}.preprocessed.2", "w", encoding="utf-8") as out_file:
403+ # print(preprocessed_script, file=out_file)
399404
400405 ## Step 8: Preprocess using the JIT and expand before executing
401406 # Uncomment when you get to step 8
402- # preprocessed_script = step8_try_unsafe(original_ast)
403- # with open(f"{input_script}.preprocessed.3", "w", encoding="utf-8") as out_file:
404- # print(preprocessed_script, file=out_file)
407+ # preprocessed_script = step8_try_unsafe(original_ast)
408+ # with open(f"{input_script}.preprocessed.3", "w", encoding="utf-8") as out_file:
409+ # print(preprocessed_script, file=out_file)
405410
406411
407412if __name__ == "__main__" :
0 commit comments