aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/12680.zig
blob: c7bd8f63aa1f884ebeba138b96e3aae1c2a2b81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const std = @import("std");
const expectEqual = std.testing.expectEqual;
const other_file = @import("12680_other_file.zig");
const builtin = @import("builtin");

extern fn test_func() callconv(.C) usize;

test "export a function twice" {
    if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
    if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
    if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
    if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;

    // If it exports the function correctly, `test_func` and `testFunc` will points to the same address.
    try expectEqual(test_func(), other_file.testFunc());
}