refactor: mv example to test
This commit is contained in:
parent
37c8ac5b2e
commit
133b2be3fc
9 changed files with 9 additions and 341 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
version: 0.17.0-dev.1398+cb5635714
|
||||
|
||||
- name: Build and run project
|
||||
run: cd example && zig build run
|
||||
run: cd test && zig build run
|
||||
|
||||
test:
|
||||
name: Test (${{ matrix.os }})
|
||||
|
|
|
|||
50
build.zig
50
build.zig
|
|
@ -3,17 +3,16 @@ const std = @import("std");
|
|||
pub fn build(b: *std.Build) !void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const is_freestanding = target.result.os.tag == .freestanding;
|
||||
const force_build_rust = b.option(bool, "build-rust", "Always build Rust library from source") orelse false;
|
||||
|
||||
// --- Rust C ABI & Pre-built via temporal-rs subpackage --- //
|
||||
const build_rust = b.option(bool, "build-rust", "Build Rust library from source");
|
||||
const libtemporal = b.dependency("libtemporal", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.@"build-rust" = force_build_rust,
|
||||
.@"build-rust" = build_rust,
|
||||
});
|
||||
|
||||
// --- Zig Module: temporalz --- //
|
||||
// --- Module: temporalz --- //
|
||||
const mod = b.addModule("temporalz", .{
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
.target = target,
|
||||
|
|
@ -21,40 +20,21 @@ pub fn build(b: *std.Build) !void {
|
|||
});
|
||||
mod.addImport("libtemporal", libtemporal.module("libtemporal"));
|
||||
|
||||
// --- Zig Executable: temporalz --- //
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "temporalz",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = if (is_freestanding)
|
||||
b.path("example/src/wasm.zig")
|
||||
else
|
||||
b.path("example/src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.imports = &.{
|
||||
.{ .name = "temporalz", .module = mod },
|
||||
},
|
||||
}),
|
||||
});
|
||||
exe.root_module.link_libc = !is_freestanding;
|
||||
exe.rdynamic = is_freestanding;
|
||||
b.installArtifact(exe);
|
||||
|
||||
// --- Steps: Run --- //
|
||||
// --- Step: run --- //
|
||||
{
|
||||
const run_step = b.step("run", "Run the example project");
|
||||
const run_step = b.step("run", "Run the test project");
|
||||
const run_cmd = b.addSystemCommand(&.{
|
||||
b.graph.zig_exe,
|
||||
"build",
|
||||
"run",
|
||||
b.fmt("-Dtarget={s}", .{try target.result.zigTriple(b.allocator)}),
|
||||
});
|
||||
run_cmd.setCwd(b.path("example"));
|
||||
run_cmd.setCwd(b.path("test"));
|
||||
run_cmd.addPassthruArgs();
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
|
||||
// --- Steps: Docs --- //
|
||||
// --- Step: docs --- //
|
||||
{
|
||||
const docs_step = b.step("docs", "Build the temporalz docs");
|
||||
const docs_obj = b.addObject(.{ .name = "temporalz", .root_module = mod });
|
||||
|
|
@ -67,7 +47,7 @@ pub fn build(b: *std.Build) !void {
|
|||
}).step);
|
||||
}
|
||||
|
||||
// --- Steps: Test --- //
|
||||
// --- Step: test --- //
|
||||
{
|
||||
const test_step = b.step("test", "Run tests");
|
||||
const mod_tests = b.addTest(.{
|
||||
|
|
@ -77,20 +57,6 @@ pub fn build(b: *std.Build) !void {
|
|||
.mode = .simple,
|
||||
},
|
||||
});
|
||||
mod_tests.root_module.link_libc = !is_freestanding;
|
||||
test_step.dependOn(&b.addRunArtifact(mod_tests).step);
|
||||
if (!is_freestanding) {
|
||||
const exe_tests = b.addTest(.{ .root_module = exe.root_module });
|
||||
test_step.dependOn(&b.addRunArtifact(exe_tests).step);
|
||||
}
|
||||
}
|
||||
|
||||
// --- Steps: test-262 --- //
|
||||
{
|
||||
const test262_step = b.step("test262", "Run test-262 tests");
|
||||
const run_cmd = b.addSystemCommand(&.{ "node", "test/test262/runner.mjs" });
|
||||
run_cmd.addPassthruArgs();
|
||||
run_cmd.step.dependOn(b.getInstallStep());
|
||||
test262_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
298
test/SPEC.md
298
test/SPEC.md
|
|
@ -1,298 +0,0 @@
|
|||
Temporal.Duration
|
||||
Temporal.Instant
|
||||
Temporal.Now
|
||||
Temporal.PlainDate
|
||||
Temporal.PlainDateTime
|
||||
Temporal.PlainMonthDay
|
||||
Temporal.PlainTime
|
||||
Temporal.PlainYearMonth
|
||||
Temporal.ZonedDateTime
|
||||
|
||||
Temporal.Duration
|
||||
Constructor
|
||||
Temporal.Duration()
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
Instance methods
|
||||
abs()
|
||||
add()
|
||||
negated()
|
||||
round()
|
||||
subtract()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toString()
|
||||
total()
|
||||
valueOf()
|
||||
with()
|
||||
Instance properties
|
||||
blank
|
||||
days
|
||||
hours
|
||||
microseconds
|
||||
milliseconds
|
||||
minutes
|
||||
months
|
||||
nanoseconds
|
||||
seconds
|
||||
sign
|
||||
weeks
|
||||
years
|
||||
|
||||
Temporal.Instant
|
||||
Constructor
|
||||
Temporal.Instant()
|
||||
Experimental
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
fromEpochMilliseconds()
|
||||
fromEpochNanoseconds()
|
||||
Instance methods
|
||||
add()
|
||||
equals()
|
||||
round()
|
||||
since()
|
||||
subtract()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toString()
|
||||
toZonedDateTimeISO()
|
||||
until()
|
||||
valueOf()
|
||||
Instance properties
|
||||
epochMilliseconds
|
||||
epochNanoseconds
|
||||
|
||||
Temporal.Now
|
||||
Static methods
|
||||
instant()
|
||||
plainDateISO()
|
||||
plainDateTimeISO()
|
||||
plainTimeISO()
|
||||
timeZoneId()
|
||||
zonedDateTimeISO()
|
||||
|
||||
Temporal.PlainDate
|
||||
Constructor
|
||||
Temporal.PlainDate()
|
||||
Experimental
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
Instance methods
|
||||
add()
|
||||
equals()
|
||||
since()
|
||||
subtract()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toPlainDateTime()
|
||||
toPlainMonthDay()
|
||||
toPlainYearMonth()
|
||||
toString()
|
||||
toZonedDateTime()
|
||||
until()
|
||||
valueOf()
|
||||
with()
|
||||
withCalendar()
|
||||
Instance properties
|
||||
calendarId
|
||||
day
|
||||
dayOfWeek
|
||||
dayOfYear
|
||||
daysInMonth
|
||||
daysInWeek
|
||||
daysInYear
|
||||
era
|
||||
eraYear
|
||||
inLeapYear
|
||||
month
|
||||
monthCode
|
||||
monthsInYear
|
||||
weekOfYear
|
||||
year
|
||||
yearOfWeek
|
||||
|
||||
Temporal.PlainDateTime
|
||||
Constructor
|
||||
Temporal.PlainDateTime()
|
||||
Experimental
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
Instance methods
|
||||
add()
|
||||
equals()
|
||||
round()
|
||||
since()
|
||||
subtract()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toPlainDate()
|
||||
toPlainTime()
|
||||
toString()
|
||||
toZonedDateTime()
|
||||
until()
|
||||
valueOf()
|
||||
with()
|
||||
withCalendar()
|
||||
withPlainTime()
|
||||
Instance properties
|
||||
calendarId
|
||||
day
|
||||
dayOfWeek
|
||||
dayOfYear
|
||||
daysInMonth
|
||||
daysInWeek
|
||||
daysInYear
|
||||
era
|
||||
eraYear
|
||||
hour
|
||||
inLeapYear
|
||||
microsecond
|
||||
millisecond
|
||||
minute
|
||||
month
|
||||
monthCode
|
||||
monthsInYear
|
||||
nanosecond
|
||||
second
|
||||
weekOfYear
|
||||
year
|
||||
yearOfWeek
|
||||
|
||||
Temporal.PlainMonthDay
|
||||
Constructor
|
||||
Temporal.PlainMonthDay()
|
||||
Experimental
|
||||
Static methods
|
||||
from()
|
||||
Instance methods
|
||||
equals()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toPlainDate()
|
||||
toString()
|
||||
valueOf()
|
||||
with()
|
||||
Instance properties
|
||||
calendarId
|
||||
day
|
||||
monthCode
|
||||
|
||||
Temporal.PlainTime
|
||||
Constructor
|
||||
Temporal.PlainTime()
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
Instance methods
|
||||
add()
|
||||
equals()
|
||||
round()
|
||||
since()
|
||||
subtract()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toString()
|
||||
until()
|
||||
valueOf()
|
||||
with()
|
||||
Instance properties
|
||||
hour
|
||||
microsecond
|
||||
millisecond
|
||||
minute
|
||||
nanosecond
|
||||
second
|
||||
|
||||
Temporal.PlainYearMonth
|
||||
Constructor
|
||||
Temporal.PlainYearMonth()
|
||||
Experimental
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
Instance methods
|
||||
add()
|
||||
equals()
|
||||
since()
|
||||
subtract()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toPlainDate()
|
||||
toString()
|
||||
until()
|
||||
valueOf()
|
||||
with()
|
||||
Instance properties
|
||||
calendarId
|
||||
daysInMonth
|
||||
daysInYear
|
||||
era
|
||||
eraYear
|
||||
inLeapYear
|
||||
month
|
||||
monthCode
|
||||
monthsInYear
|
||||
year
|
||||
|
||||
Temporal.ZonedDateTime
|
||||
Constructor
|
||||
Temporal.ZonedDateTime()
|
||||
Experimental
|
||||
Static methods
|
||||
compare()
|
||||
from()
|
||||
Instance methods
|
||||
add()
|
||||
equals()
|
||||
getTimeZoneTransition()
|
||||
round()
|
||||
since()
|
||||
startOfDay()
|
||||
subtract()
|
||||
toInstant()
|
||||
toJSON()
|
||||
toLocaleString()
|
||||
toPlainDate()
|
||||
toPlainDateTime()
|
||||
toPlainTime()
|
||||
toString()
|
||||
until()
|
||||
valueOf()
|
||||
with()
|
||||
withCalendar()
|
||||
withPlainTime()
|
||||
withTimeZone()
|
||||
Instance properties
|
||||
calendarId
|
||||
day
|
||||
dayOfWeek
|
||||
dayOfYear
|
||||
daysInMonth
|
||||
daysInWeek
|
||||
daysInYear
|
||||
epochMilliseconds
|
||||
epochNanoseconds
|
||||
era
|
||||
eraYear
|
||||
hour
|
||||
hoursInDay
|
||||
inLeapYear
|
||||
microsecond
|
||||
millisecond
|
||||
minute
|
||||
month
|
||||
monthCode
|
||||
monthsInYear
|
||||
nanosecond
|
||||
offset
|
||||
offsetNanoseconds
|
||||
second
|
||||
timeZoneId
|
||||
weekOfYear
|
||||
year
|
||||
yearOfWeek
|
||||
Loading…
Add table
Reference in a new issue