Add a Platform class.
- Rename the "process" module to "os". - Add Platform to it. - Static "name" method. - Static "isPosix" method. - Docs and tests!
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import "os" for Platform
|
||||
|
||||
// Can't test for certain values since this test is cross-platform, but we can
|
||||
// at least make sure it is callable and returns a bool.
|
||||
System.print(Platform.isPosix is Bool) // expect: true
|
||||
@@ -0,0 +1,5 @@
|
||||
import "os" for Platform
|
||||
|
||||
// Can't test for certain values since this test is cross-platform, but we can
|
||||
// at least make sure it is callable and returns a string.
|
||||
System.print(Platform.name is String) // expect: true
|
||||
@@ -0,0 +1,11 @@
|
||||
import "os" for Process
|
||||
|
||||
var args = Process.allArguments
|
||||
System.print(args is List) // expect: true
|
||||
System.print(args.count) // expect: 2
|
||||
|
||||
// Includes wren executable and file being run.
|
||||
System.print(args[0].endsWith("wrend")) // expect: true
|
||||
System.print(args[1]) // expect: test/os/process/all_arguments.wren
|
||||
|
||||
// TODO: Test passing additional args once we have an API to spawn a process.
|
||||
@@ -0,0 +1,6 @@
|
||||
import "os" for Process
|
||||
|
||||
// No additional arguments are passed to the test.
|
||||
System.print(Process.arguments) // expect: []
|
||||
|
||||
// TODO: Test passing additional args once we have an API to spawn a process.
|
||||
Reference in New Issue
Block a user