test:zig
This commit is contained in:
14
guide/language/imports.zig
Normal file
14
guide/language/imports.zig
Normal file
@@ -0,0 +1,14 @@
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
const math = std.math;
|
||||
|
||||
// The built-in function `@import` takes in a file, and gives you a struct type based on that file.
|
||||
// All declarations labelled as `pub` (for public) will end up in this struct type, ready for use.
|
||||
|
||||
// `@import("std")` is a special case in the compiler, and gives you access to the standard library.
|
||||
// Other `@import`s will take in a file path, or a package name (more on packages in a later chapter).
|
||||
// We will explore more of the standard library in later chapters.
|
||||
|
||||
test "imports" {
|
||||
try expect(math.pow(f32, 2, 3) == 8.0);
|
||||
}
|
||||
Reference in New Issue
Block a user