Sasha Smundak | 24159db | 2020-10-26 15:43:21 -0700 | [diff] [blame] | 1 | # Tests file ops builtins |
| 2 | load("assert.star", "assert") |
| 3 | |
| 4 | |
| 5 | def test(): |
| 6 | myname = "file_ops.star" |
Sasha Smundak | 3c56979 | 2021-08-05 17:33:15 -0700 | [diff] [blame] | 7 | assert.true(rblf_file_exists("."), "./ exists ") |
Sasha Smundak | 24159db | 2020-10-26 15:43:21 -0700 | [diff] [blame] | 8 | assert.true(rblf_file_exists(myname), "the file %s does exist" % myname) |
| 9 | assert.true(not rblf_file_exists("no_such_file"), "the file no_such_file does not exist") |
| 10 | files = rblf_wildcard("*.star") |
| 11 | assert.true(myname in files, "expected %s in %s" % (myname, files)) |
| 12 | # RBCDATADIR is set by the caller to the path where this file resides |
| 13 | files = rblf_wildcard("*.star", rblf_env.TEST_DATA_DIR) |
| 14 | assert.true(myname in files, "expected %s in %s" % (myname, files)) |
| 15 | files = rblf_wildcard("*.xxx") |
| 16 | assert.true(len(files) == 0, "expansion should be empty but contains %s" % files) |
| 17 | |
| 18 | |
| 19 | test() |