Files
swift-mirror/test/embedded/wasm/libc_functions.swift
Max Desiatov 53a2945ecc tests: Enable the lit test suite for wasm32-unknown-emscripten (#89806)
Enable the Embedded Swift and stdlib lit tests to run on `wasm32-unknown-emscripten`. Embedded Swift linker RUN lines move off the hard-coded `%target-clang` onto a `%target-embedded-link` substitution that links through `emcc` on Emscripten and keeps `%target-clang` for other platforms elsewhere. The `REQUIRES`/`UNSUPPORTED` gates gain an `OS=emscripten` arm, so emscripten runs the `wasip1` tests it shares and skips the ones it cannot satisfy yet. Also renamed `wasilibc_functions.swift` to `libc_functions.swift` and updated `docs/WebAssembly.md`.
2026-06-15 15:15:16 +01:00

26 lines
557 B
Swift

// RUN: %target-run-simple-swift(-enable-experimental-feature Embedded -parse-as-library -wmo) | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: OS=wasip1 || OS=emscripten
// REQUIRES: swift_feature_Embedded
#if canImport(WASILibc)
import WASILibc
#elseif canImport(EmscriptenLibc)
import EmscriptenLibc
#else
#error("Unsupported libc")
#endif
@main struct Main {
static func main() {
puts("Hello")
// CHECK: Hello
let div_result = div(5,2)
print(div_result.quot)
// CHECK: 2
print(div_result.rem)
// CHECK: 1
}
}