Initial commit

This commit is contained in:
Cameron Reed 2024-07-23 22:13:42 -06:00
commit b5ec5f394f
11 changed files with 320 additions and 0 deletions

View File

@ -0,0 +1,157 @@
0
46350 29108609 1721794350226692716 7f7cb8ef643c5d4a9b9dfb38c13b99b8 0 /home/cameron-arch/.cache/zls/build_runner/21872970afd69e48a0847077e5196711/build_runner.zig
3831 24117278 1721794320127004953 b349b6f41e28d71d776e636a64e80760 0 /home/cameron/projects/panes/build.zig
103 0 0 35b10ba982858800c98ffbaad5536a86 2 o/a32fcfc0e475f08356ed8aef4020640b/dependencies.zig
7616 2652281 1720029513000000000 a112ef71b351e8f79f6f43c583ede25c 1 std/std.zig
23040 2652278 1720029513000000000 da66963546b611ee7750a27396b7d1ea 1 std/start.zig
115223 2652033 1720029513000000000 864599658ca312005d8d3860dcc5d44e 1 std/debug.zig
3057 28708209 1721096207431693615 722ad54113b8eff889ebedafec7c44bb 0 /home/cameron-arch/.cache/zig/b/722ad54113b8eff889ebedafec7c44bb/builtin.zig
33165 2651940 1720029513000000000 f94156764e93e22ac481419ae3dcd7e2 1 std/builtin.zig
87972 2651920 1720029513000000000 2058e9176f2f8c413153da85bdefea9a 1 std/Target.zig
129328 2764207 1720029513000000000 aa1c9ead6b093aa4fc744cbaf6cdb147 1 std/Target/x86.zig
73503 2652139 1720029513000000000 4f495cdd87469544c122e37211fe3d16 1 std/math.zig
41362 2652206 1720029513000000000 222d7cb14bd7ca087b75cbc16cba6dda 1 std/meta.zig
11091 2651919 1720029513000000000 3b4e837c9f6b3b4fbb5b3b95148e553c 1 std/SemanticVersion.zig
61526 2652046 1720029513000000000 00003d31510dec096134200d0d6ceecc 1 std/elf.zig
12325 2652213 1720029513000000000 2229bf6824a9119504139fcdb850890e 1 std/os.zig
207296 2652215 1720029513000000000 651fd04e37ca32286baf84da551c7ce0 1 std/os/linux.zig
12494 2652237 1720029513000000000 e9933b000fa707703dab8f2fe68b002a 1 std/os/linux/tls.zig
293019 2652270 1720029513000000000 3aef046ab18b515bbbbf65ba8531ef93 1 std/posix.zig
31762 2652082 1720029513000000000 39822c5f2ad237650217b35e72989b75 1 std/heap.zig
12747 2652087 1720029513000000000 0c84990d94912da71f88ccdd844ff032 1 std/heap/arena_allocator.zig
176912 2652204 1720029513000000000 223e2fd0f89a74fd7d5132dbe48f1c2c 1 std/mem.zig
13626 2652205 1720029513000000000 98c52b2fa05c32ad77f1743a5f3383ee 1 std/mem/Allocator.zig
14239 2652136 1720029513000000000 a69e9fd3810cdd1601c26dd47210af71 1 std/linked_list.zig
3917 2652083 1720029513000000000 985cae2df1113f68d7f2eca79afe1887 1 std/heap/PageAllocator.zig
1301 2652084 1720029513000000000 3db24c00baa9c03a40bfeaa152e28593 1 std/heap/ThreadSafeAllocator.zig
54097 2651921 1720029513000000000 5fc2474d41197418fc547d7d64491a85 1 std/Thread.zig
10030 2651924 1720029513000000000 6ec4900de2fa66c512d3a1a8b197182b 1 std/Thread/Mutex.zig
19056 2651934 1720029513000000000 fbe5a337296572a6d62cbde681c465ea 1 std/atomic.zig
74835 2652273 1720029513000000000 26bff32158c4e55ea1dbd7cbd193b2d5 1 std/process.zig
87217 2651932 1720029513000000000 d82200bd8e9f05406e233eef46e48149 1 std/array_list.zig
95593 2651915 1720029513000000000 eb7f21887b8d6d3a1ea72f4fb7e18f23 1 std/Build.zig
48541 3019865 1720029513000000000 f0b7461b8459a4c71e300129f17dffb2 1 std/Build/Cache.zig
2248 3019867 1720029513000000000 95a1bb668e0c39f345c83920bac861b7 1 std/Build/Cache/Directory.zig
35816 2652061 1720029513000000000 9ad542fb9d5f647b2fd9aa956a4876f1 1 std/fs.zig
112808 2652063 1720029513000000000 736eee48bb9f3802d7054c19abc437df 1 std/fs/Dir.zig
65843 2652064 1720029513000000000 2f1e7806f11f80320d184c737b99b781 1 std/fs/File.zig
114248 2651931 1720029513000000000 7aa5a3d5d7c75f7861328581549e6a5d 1 std/array_hash_map.zig
38005 2652208 1720029513000000000 2df15a06c9368a128b68d617837153ef 1 std/multi_array_list.zig
12352 2651965 1720029513000000000 85ba4034d104ed83a45a1bb6ea2f588a 1 std/crypto.zig
18622 2652028 1720029513000000000 05742583e9b394547e0631c84131938c 1 std/crypto/siphash.zig
89980 2652081 1720029513000000000 52e58e0e5a1dd700c7ba1de70432e45c 1 std/hash_map.zig
26882 2764186 1720029513000000000 5b9ff543d20a09f8c07cb235a7f3c28e 1 std/Target/Query.zig
45679 2652295 1720029513000000000 495dd771e7b568e386535b63332d9a02 1 std/zig.zig
52150 2652316 1720029513000000000 d488bc81fd0ba877c413ee9c01ed7219 1 std/zig/system.zig
18992 3019870 1720029513000000000 f8e31f1e40286aec688457f633c109d1 1 std/Build/Step.zig
27571 3019869 1720029513000000000 f1a35ffb70613c5c506de0b9feb42a25 1 std/Build/Module.zig
16219 3019886 1720029513000000000 ebb5646fc6c1cbeff8fff92f756e2694 1 std/Build/Step/WriteFile.zig
50900 2651916 1720029513000000000 00b173ccd55aed075eef5aa1dccad55a 1 std/Progress.zig
29025 2652301 1720029513000000000 2573e2c79bf66e3476b0024f0dfa2173 1 std/zig/ErrorBundle.zig
76968 3019875 1720029513000000000 0500528ea762b29f66289290fec117d5 1 std/Build/Step/Compile.zig
112489 2652034 1720029513000000000 d33cf67bbc2809a1c38591e04f1e3f51 1 std/dwarf.zig
31915 3019876 1720029513000000000 6880c5430ee92854d2f87b8087aabbb0 1 std/Build/Step/ConfigHeader.zig
1884 2652193 1720029513000000000 4e39bcecc218a8cefd7304859e028778 1 std/math/log2.zig
5989 2651925 1720029513000000000 9b884db4ae244ef2af3dcea90ca42736 1 std/Thread/Pool.zig
8321 2652137 1720029513000000000 445ca968f1971dbcfae846f76f46cc2d 1 std/log.zig
106358 2652049 1720029513000000000 9b602efb3cf67bc725c9853d5fe33864 1 std/fmt.zig
14616 2651933 1720029513000000000 0fed3eb789529104667fd82e81a9af62 1 std/ascii.zig
13689 2652285 1720029513000000000 131aba425aefaef0d374793c2dd9e731 1 std/time.zig
77139 2652066 1720029513000000000 6ed68741d6922f90c45c6c388b6cdd8c 1 std/fs/path.zig
12563 2652240 1720029513000000000 edca846565ef855c728e7372feed8676 1 std/os/linux/x86_64.zig
72708 2652274 1720029513000000000 046fa60b44c156af61840e746b56a6c2 1 std/process/Child.zig
200963 2652256 1720029513000000000 6382cd937e84a8fc6ae02341db586df9 1 std/os/windows.zig
394 29108608 1721794350226692716 e2a5dc77f7477e12f9d09568c618e70c 0 /home/cameron-arch/.cache/zls/build_runner/21872970afd69e48a0847077e5196711/BuildConfig.zig
5954 2652121 1720029513000000000 ca96a7daf60a978c600a94a94daaea90 1 std/json.zig
3257 2652126 1720029513000000000 b6a0926202bd08dbf296c65a9af6c72b 1 std/json/hashmap.zig
29391 2652132 1720029513000000000 8c1d345a91a2c23c70cadb25b14a213b 1 std/json/stringify.zig
25700 2652101 1720029513000000000 2c3e57ebee88e5b426bac4e5144d55a2 1 std/io.zig
13386 2652255 1720029513000000000 b23fdad07ce3b3bc638202a13d269a17 1 std/os/wasi.zig
6224 2652030 1720029513000000000 1478fc3a3f5e7178b0ebc595cf60927a 1 std/crypto/tlcsprng.zig
2697 2652103 1720029513000000000 8464fd0bdf5c1f8ba10a286a4fe46f4d 1 std/io/Writer.zig
29780 2652277 1720029513000000000 f63bcad555043dc37b62da5b7656cb6e 1 std/sort.zig
51714 3019909 1720029513000000000 eb8790d984ce4a6ddd6376d877c85ff1 1 std/sort/block.zig
82077 2652289 1720029513000000000 d5fc31f78c3ec8b424ea391b2e65f728 1 std/unicode.zig
76391 2764190 1720029513000000000 4668a311541b6be75afd88bf66028ad5 1 std/Target/arm.zig
17620 2652280 1720029513000000000 11fc6dca32658eb05179945f9031219f 1 std/static_string_map.zig
10710 3019910 1720029513000000000 f2973ab2be6115a15cf6c75a2be36ad3 1 std/sort/pdq.zig
7643 2652198 1720029513000000000 03910049e32f401cd3296cc1352aecb4 1 std/math/powi.zig
9239 2651926 1720029513000000000 d703f6a7af8c150d259a587850decd1f 1 std/Thread/ResetEvent.zig
17590 2651917 1720029513000000000 5ddd4d07802b9f332a306c207663eea0 1 std/Random.zig
3177 2764181 1720029513000000000 ece4176296c0d5a4735a0e13195d3e89 1 std/Random/Xoshiro256.zig
23359 2651922 1720029513000000000 55e7c53750c5f84af61f7e61406bc0f0 1 std/Thread/Condition.zig
1796 2651929 1720029513000000000 43f2cf40b5fd32903bf18a54ea66fc91 1 std/Thread/WaitGroup.zig
5461 2652120 1720029513000000000 ed6aac6dd443d6bdac1cf31688d1b444 1 std/io/tty.zig
14434 2652102 1720029513000000000 2655b33c088dd930683d9eb843eaceb4 1 std/io/Reader.zig
55939 2652047 1720029513000000000 9fbbf465379ce46a9365e411debc3ce1 1 std/enums.zig
1730 2652070 1720029513000000000 36cb1b0b5e0bb7d10f9b200b0a751743 1 std/hash.zig
19972 2652075 1720029513000000000 c36dede4b91e35db37ea45c66dbe6fe9 1 std/hash/crc.zig
3882 3019906 1720029513000000000 168f6844905becfc3ec252416dbee69f 1 std/hash/crc/impl.zig
6449 2652114 1720029513000000000 3bcfe7862cea857ee79939a098991ad5 1 std/io/fixed_buffer_stream.zig
2057 2651957 1720029513000000000 a778ec13ef93e0ace847f52f066441fd 1 std/compress.zig
3736 2651963 1720029513000000000 a5c9eee5eaf5943e22c8a03fac3f2841 1 std/compress/zlib.zig
23844 2764222 1720029513000000000 61343f5304677e260ccaed8ba225c2b1 1 std/compress/flate/inflate.zig
7460 2764218 1720029513000000000 1c1d1c1c4e61c64090b7ace80a4c2dab 1 std/compress/flate/container.zig
16625 2764214 1720029513000000000 8ba4aa19f03596c0d0eb18045a7331e8 1 std/compress/flate/bit_reader.zig
7434 2764210 1720029513000000000 a6347ffd91bdf7b166947d627e9f38c5 1 std/compress/flate/CircularBuffer.zig
3519 2652071 1720029513000000000 4e3c7d701979e5945ab9f85fed59a579 1 std/hash/adler.zig
10966 2764220 1720029513000000000 e24401bc06abbf873844211e243f0871 1 std/compress/flate/huffman_decoder.zig
1399 2652038 1720029513000000000 40a7d4ac60d12c6e9ca294acaed35474 1 std/dwarf/FORM.zig
3900 2652041 1720029513000000000 b5711d1b73e43c5aaea25647f88f9369 1 std/dwarf/TAG.zig
7395 2652035 1720029513000000000 0736a520f4793791a2cfc257bfcfd3b6 1 std/dwarf/AT.zig
643 2652037 1720029513000000000 6f6a9e4e1602df062ad02179710971c4 1 std/dwarf/EH.zig
94423 2652234 1720029513000000000 936f06081ca66c21f2225e91832d8a41 1 std/os/linux/syscalls.zig
19768 2652323 1720029513000000000 817d70e351edd4b746ab4c444c0d2b09 1 std/zig/system/x86.zig
1273 2764189 1720029513000000000 92589c8e708010b66287cffb30b3644a 1 std/Target/arc.zig
69762 2764191 1720029513000000000 d6af57434a87d01c08b32d2bfe25fdaa 1 std/Target/avr.zig
77144 2764193 1720029513000000000 c690addfa0ddc66f16428c3843909a46 1 std/Target/csky.zig
16084 2764194 1720029513000000000 ca6f1a2a9e6e8fa60a8331d7c5f5ce34 1 std/Target/hexagon.zig
7121 2764196 1720029513000000000 d75880c23fe47c4e74168b752266aab9 1 std/Target/m68k.zig
2220 2764198 1720029513000000000 d6af7e91115ce15de6cc6fa6b85ad607 1 std/Target/msp430.zig
81486 2764188 1720029513000000000 c94083fc646f9b20640e65787e33fdc0 1 std/Target/amdgpu.zig
25913 2764202 1720029513000000000 9d8c66f36c8cefa8cdeac8497ff9ed3d 1 std/Target/s390x.zig
1273 2764208 1720029513000000000 1becbd14309ffd333ba9f93137feeab0 1 std/Target/xtensa.zig
1275 2764205 1720029513000000000 3f87de4b4cab37706212bd9a456a8c58 1 std/Target/ve.zig
94346 2764187 1720029513000000000 136876fa8ce544da55eab725094091a5 1 std/Target/aarch64.zig
2409 2764192 1720029513000000000 1693b91547d868068f63e102f2ccb211 1 std/Target/bpf.zig
5236 2764195 1720029513000000000 fd217450c001fea386e26e5ae8ee436e 1 std/Target/loongarch.zig
16066 2764197 1720029513000000000 6e5fb373b9f2ae19c60dbed74eb241dc 1 std/Target/mips.zig
34534 2764200 1720029513000000000 51352484986d855d36c4732d68bc73d0 1 std/Target/powerpc.zig
53948 2764201 1720029513000000000 5dd87bdcf11a3787d33834ee1afcb1ea 1 std/Target/riscv.zig
19757 2764203 1720029513000000000 81e62932de5b471d355190a547b0390a 1 std/Target/sparc.zig
77930 2764204 1720029513000000000 0611f617b9ec2d1a8e22aa44c1fe7363 1 std/Target/spirv.zig
13279 2764199 1720029513000000000 c4c3d3112933eb72020bc9eebc304ed2 1 std/Target/nvptx.zig
4508 2764206 1720029513000000000 d86c84e4bae678df19d1bcef0e88aef9 1 std/Target/wasm.zig
19546 2652042 1720029513000000000 eeb537ce254d8635c5876f3cb23ba2ab 1 std/dwarf/abi.zig
26403 2652043 1720029513000000000 17cfec6893f0195cf3f2128e131aebbd 1 std/dwarf/call_frame.zig
71838 2652044 1720029513000000000 472566d679006f02ce08a8e6d3ca5840 1 std/dwarf/expressions.zig
10091 2652291 1720029513000000000 616a2d791eb8d67329f8198701e2bbad 1 std/valgrind.zig
23129 2652276 1720029513000000000 b579436bcc763fc86642b2a1d69be89a 1 std/simd.zig
58779 3019884 1720029513000000000 2628367b628e7df7bf938bc2188b14e7 1 std/Build/Step/Run.zig
17036 2652045 1720029513000000000 e5e4bda8771008b986953e018b241bdd 1 std/dynamic_library.zig
17851 2652135 1720029513000000000 62510503fe6b45659189d32c19c9dc45 1 std/leb128.zig
43084 2651923 1720029513000000000 a67e9f409c649ae15d47dcc9582247f0 1 std/Thread/Futex.zig
1299 2652108 1720029513000000000 9ea5eaf4f2d36e2273f3ecec7f813b61 1 std/io/buffered_writer.zig
9295 3019878 1720029513000000000 268e240d3773b7543a10f2365b34cc53 1 std/Build/Step/InstallArtifact.zig
530 2764179 1720029513000000000 6862d091fadcbbb652464ab10689bd23 1 std/Random/SplitMix64.zig
2496 2651914 1720029513000000000 51fed0f372bbe1737cc4b59d4258ebe3 1 std/BitStack.zig
8372 2652079 1720029513000000000 d48498b32f349820311bbf338ae1aae5 1 std/hash/wyhash.zig
1160 2652112 1720029513000000000 32ae6866d358d400739c8281e2b92d26 1 std/io/counting_writer.zig
1618 2764217 1720029513000000000 60e22c8a23680b34b51d27b486811807 1 std/compress/flate/consts.zig
13375 2764213 1720029513000000000 239244362ca7a3d92e32a4518ccda927 1 std/compress/flate/Token.zig
36892 2652026 1720029513000000000 aeaa6f15041af562aebdfbb8f2e94f9d 1 std/crypto/sha2.zig
20392 2652048 1720029513000000000 a41115e4a4263ff02975e97d21f21847 1 std/fifo.zig
1464 2652300 1720029513000000000 262bf5a41c36322233615e07256bc570 1 std/zig/Client.zig
8752 2652305 1720029513000000000 2d7e0835ecf9b1ce89b625495c8209c2 1 std/zig/Server.zig
2591 2652062 1720029513000000000 54cecc0501b004131b133c8ec52688b3 1 std/fs/AtomicFile.zig
23028 2651935 1720029513000000000 5f649adf883cb2acad194b60017a4672 1 std/base64.zig
39156 3019866 1720029513000000000 628e7a63840b5d008ad84d18a2a50b21 1 std/Build/Cache/DepTokenizer.zig
2685 2764174 1720029513000000000 5244bfd5edd68ad074bfdf866029fa86 1 std/Random/ChaCha.zig
52267 2651987 1720029513000000000 250bf69f713193c74da886706bb53369 1 std/crypto/chacha20.zig
5693 2652040 1720029513000000000 01d731f8d28ba8382ff3c5885d5e0c75 1 std/dwarf/OP.zig
7399 2652032 1720029513000000000 7e3716a3c82a36541c6cf09b56a96da0 1 std/crypto/utils.zig
1539 2652115 1720029513000000000 ca6d9ebe9107eb6ffe4cc4b92611772a 1 std/io/limited_reader.zig
64174 2651941 1720029513000000000 ecfd926ec456ba7acf15b5e7bec5f532 1 std/c.zig
10812 2651950 1720029513000000000 b5d2e09197008802157fd9bda951945e 1 std/c/linux.zig
14595 2652072 1720029513000000000 9802848537ec3da81ac651945a298250 1 std/hash/auto_hash.zig
3957 2652238 1720029513000000000 8a6d08b36d5d25b29bdff67ade3e947b 1 std/os/linux/vdso.zig

0
.zig-cache/h/timestamp Normal file
View File

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
pub const packages = struct {};
pub const root_deps: []const struct { []const u8, []const u8 } = &.{};

Binary file not shown.

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Cameron Reed
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

91
build.zig Normal file
View File

@ -0,0 +1,91 @@
const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard optimization options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "panes",
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
// This declares intent for the library to be installed into the standard
// location when the user invokes the "install" step (the default step when
// running `zig build`).
b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "panes",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default
// step when running `zig build`).
b.installArtifact(exe);
// This *creates* a Run step in the build graph, to be executed when another
// step is evaluated that depends on it. The next line below will establish
// such a dependency.
const run_cmd = b.addRunArtifact(exe);
// By making the run step depend on the install step, it will be run from the
// installation directory rather than directly from within the cache directory.
// This is not necessary, however, if the application depends on other installed
// files, this ensures they will be present and in the expected location.
run_cmd.step.dependOn(b.getInstallStep());
// This allows the user to pass arguments to the application in the build
// command itself, like this: `zig build run -- arg1 arg2 etc`
if (b.args) |args| {
run_cmd.addArgs(args);
}
// This creates a build step. It will be visible in the `zig build --help` menu,
// and can be selected like this: `zig build run`
// This will evaluate the `run` step rather than the default, which is "install".
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
// Similar to creating the run step earlier, this exposes a `test` step to
// the `zig build --help` menu, providing a way for the user to request
// running the unit tests.
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
test_step.dependOn(&run_exe_unit_tests.step);
}

15
build.zig.zon Normal file
View File

@ -0,0 +1,15 @@
.{
.name = "panes",
.version = "0.0.0",
.dependencies = .{},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
"LICENSE",
//"README.md",
},
}

24
src/main.zig Normal file
View File

@ -0,0 +1,24 @@
const std = @import("std");
pub fn main() !void {
// Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
// stdout is for the actual output of your application, for example if you
// are implementing gzip, then only the compressed bytes should be sent to
// stdout, not any debugging messages.
const stdout_file = std.io.getStdOut().writer();
var bw = std.io.bufferedWriter(stdout_file);
const stdout = bw.writer();
try stdout.print("Run `zig build test` to run the tests.\n", .{});
try bw.flush(); // don't forget to flush!
}
test "simple test" {
var list = std.ArrayList(i32).init(std.testing.allocator);
defer list.deinit(); // try commenting this out and see if zig detects the memory leak!
try list.append(42);
try std.testing.expectEqual(@as(i32, 42), list.pop());
}

10
src/root.zig Normal file
View File

@ -0,0 +1,10 @@
const std = @import("std");
const testing = std.testing;
export fn add(a: i32, b: i32) i32 {
return a + b;
}
test "basic add functionality" {
try testing.expect(add(3, 7) == 10);
}