| 1 | # Tests that cmd2 populates __name__, __file__, and sets sys.path[0] to our directory |
| 2 | import os |
| 3 | import sys |
| 4 | |
| 5 | if __name__ != "__main__": |
| 6 | print(f"Error: __name__ is: {__name__}") |
| 7 | quit() |
| 8 | |
| 9 | if __file__ != sys.argv[0]: |
| 10 | print(f"Error: __file__ is: {__file__}") |
| 11 | quit() |
| 12 | |
| 13 | our_dir = os.path.dirname(os.path.abspath(__file__)) |
| 14 | if our_dir != sys.path[0]: |
| 15 | print(f"Error: our_dir is: {our_dir}") |
| 16 | quit() |
| 17 | |
| 18 | print("PASSED") |