feat: load canonical directory packages
This commit is contained in:
@@ -218,3 +218,23 @@ propagates_identifier_interning_allocation_failure test {
|
||||
try testing.expect_equal(usize(0), allocation.live)
|
||||
}
|
||||
}
|
||||
|
||||
scans_import_keywords_and_preserves_source_in_tokens_and_diagnostics test {
|
||||
pool := strpool.init(mem.c_allocator)
|
||||
defer strpool.deinit(&pool)
|
||||
diagnostic_store := diagnostics.init(mem.c_allocator)
|
||||
defer diagnostics.deinit(&diagnostic_store)
|
||||
state := init(mem.c_allocator)
|
||||
defer deinit(&state)
|
||||
state.source_id = diagnostics.SourceId(7)
|
||||
try scan(&state, "import test $\n1.\n\"unfinished", &pool, &diagnostic_store)
|
||||
try testing.expect_equal(TokenKind.import, state.tokens.items[0].kind)
|
||||
try testing.expect_equal(TokenKind.test, state.tokens.items[1].kind)
|
||||
try testing.expect_equal(null, strpool.get_id(&pool, "import"))
|
||||
try testing.expect_equal(null, strpool.get_id(&pool, "test"))
|
||||
for (state.tokens.items) |token| try testing.expect_equal(state.source_id, token.span.source)
|
||||
try testing.expect_equal(3, diagnostics.count(&diagnostic_store))
|
||||
for (diagnostic_store.list.items) |diagnostic| {
|
||||
try testing.expect_equal(state.source_id, diagnostic.span.source)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user