• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / x / 301

10 Dec 2024 06:19AM UTC coverage: 85.204% (-2.6%) from 87.841%
301

Pull #78

github

web-flow
Merge b830031f4 into 91f0fdf48
Pull Request #78: feat: new package encoding

105 of 161 new or added lines in 3 files covered. (65.22%)

124 existing lines in 29 files now uncovered.

1169 of 1372 relevant lines covered (85.2%)

434.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/sys/internal/ffi/sys_wasm.mbt
1
// Copyright 2024 International Digital Economy Academy
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
///|
16
typealias XExternStringArray = @ffi.XExternStringArray
17

18
///|
19
typealias XExternString = @ffi.XExternString
20

21
///|
22
pub fn get_cli_args() -> Array[String] {
UNCOV
23
  let args = get_cli_args_ffi()
×
24
  @ffi.string_array_from_extern(args)
25
}
26

27
///|
28
fn get_cli_args_ffi() -> XExternStringArray = "__moonbit_fs_unstable" "args_get"
29

30
///|
31
pub fn get_env_vars() -> Map[String, String] {
32
  let env = get_env_vars_ffi()
2✔
33
  let tmp = @ffi.string_array_from_extern(env)
34
  let res = {}
35
  for i = 0; i < tmp.length(); i = i + 2 {
231✔
36
    res[tmp[i]] = tmp[i + 1]
231✔
37
  }
38
  res
39
}
40

41
///|
42
fn get_env_vars_ffi() -> XExternStringArray = "__moonbit_fs_unstable" "get_env_vars"
43

44
///|
45
pub fn set_env_var(key : String, value : String) -> Unit {
46
  let key = @ffi.string_to_extern(key)
1✔
47
  let value = @ffi.string_to_extern(value)
48
  set_env_var_ffi(key, value)
49
}
50

51
///|
52
fn set_env_var_ffi(key : XExternString, value : XExternString) = "__moonbit_fs_unstable" "set_env_var"
53

54
///|
55
pub fn exit(code : Int) = "__moonbit_sys_unstable" "exit"
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc