mirror of https://github.com/tildeio/helix
Don't automatically derive Clone
Also add a place to start doing more unit-style testing. Fixes #143
This commit is contained in:
parent
32d6a67b11
commit
8f1acbcfb1
|
@ -3,7 +3,7 @@ cache:
|
|||
- '%HOMEDRIVE%%HOMEPATH%\.multirust -> .appveyor.yml'
|
||||
|
||||
environment:
|
||||
EXAMPLES: duration calculator console geometry membership text_transform turbo_blank json_builder
|
||||
EXAMPLES: unit duration calculator console geometry membership text_transform turbo_blank json_builder
|
||||
VERBOSE: true
|
||||
RUST_BACKTRACE: 1
|
||||
matrix:
|
||||
|
|
|
@ -21,7 +21,7 @@ cache:
|
|||
|
||||
env:
|
||||
global:
|
||||
- EXAMPLES="duration calculator console geometry membership text_transform turbo_blank json_builder"
|
||||
- EXAMPLES="unit duration calculator console geometry membership text_transform turbo_blank json_builder"
|
||||
- VERBOSE=true
|
||||
- RUST_BACKTRACE=1
|
||||
- RUST_VERSION=stable
|
||||
|
|
|
@ -21,7 +21,7 @@ appveyor = { repository = "tildeio/helix", branch = "master", service = "github"
|
|||
|
||||
[workspace]
|
||||
|
||||
members = ["examples/calculator", "examples/console", "examples/geometry", "examples/duration", "examples/membership", "examples/text_transform", "examples/turbo_blank", "examples/json_builder"]
|
||||
members = ["examples/unit", "examples/calculator", "examples/console", "examples/geometry", "examples/duration", "examples/membership", "examples/text_transform", "examples/turbo_blank", "examples/json_builder"]
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2.0"
|
||||
|
|
4
Rakefile
4
Rakefile
|
@ -4,7 +4,7 @@ task :test do
|
|||
sh "bundle exec rake"
|
||||
end
|
||||
|
||||
examples = ENV["EXAMPLES"] || "duration calculator console geometry membership text_transform turbo_blank json_builder"
|
||||
examples = ENV["EXAMPLES"] || "unit duration calculator console geometry membership text_transform turbo_blank json_builder"
|
||||
|
||||
sh "bash ./examples/runner default #{examples}"
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ task :install do
|
|||
sh "bundle"
|
||||
end
|
||||
|
||||
examples = ENV["EXAMPLES"] || "duration calculator console geometry membership text_transform turbo_blank json_builder"
|
||||
examples = ENV["EXAMPLES"] || "unit duration calculator console geometry membership text_transform turbo_blank json_builder"
|
||||
|
||||
sh "bash ./examples/runner install #{examples}"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
target
|
||||
*.bundle
|
||||
*.gem
|
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "unit"
|
||||
version = "0.1.0"
|
||||
authors = ["Godfrey Chan <godfrey@tilde.io>"]
|
||||
|
||||
[lib]
|
||||
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies.helix]
|
||||
path = "../.."
|
|
@ -0,0 +1,5 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'helix_runtime', path: '../../ruby'
|
||||
gem 'rake', '~> 10.0'
|
||||
gem 'rspec', '~> 3.4'
|
|
@ -0,0 +1,20 @@
|
|||
require 'bundler/setup'
|
||||
require 'helix_runtime/build_task'
|
||||
require 'rspec/core/rake_task'
|
||||
require_relative '../shared.rb'
|
||||
|
||||
# For Windows
|
||||
$stdout.sync = true
|
||||
|
||||
HelixRuntime::BuildTask.new do |t|
|
||||
t.build_root = File.expand_path("../..", __dir__)
|
||||
t.helix_lib_dir = File.expand_path("../../ruby/windows_build", __dir__)
|
||||
t.pre_build = HelixRuntime::Tests.pre_build
|
||||
end
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec) do |t|
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
task :spec => :build
|
||||
task :default => :spec
|
|
@ -0,0 +1,2 @@
|
|||
require 'helix_runtime'
|
||||
require 'unit/native'
|
|
@ -0,0 +1,2 @@
|
|||
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
||||
require 'unit'
|
|
@ -0,0 +1,10 @@
|
|||
require "spec_helper"
|
||||
|
||||
describe ClassContainingNonClonableFields do
|
||||
it "works" do
|
||||
c = ClassContainingNonClonableFields.new
|
||||
|
||||
expect(c).to be_instance_of(ClassContainingNonClonableFields)
|
||||
expect(c.to_s).to eq("ClassContainingNonClonableFields")
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
#![recursion_limit="1024"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate helix;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct NotClonable();
|
||||
|
||||
ruby! {
|
||||
class ClassContainingNonClonableFields {
|
||||
struct {
|
||||
inner: NotClonable,
|
||||
}
|
||||
|
||||
def initialize(helix) {
|
||||
ClassContainingNonClonableFields { helix, inner: NotClonable {} }
|
||||
}
|
||||
|
||||
def to_s(&self) -> &'static str {
|
||||
"ClassContainingNonClonableFields"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -146,7 +146,7 @@ macro_rules! codegen_struct {
|
|||
ruby_name: $ruby_name:tt,
|
||||
struct: { $($struct:tt)* }
|
||||
} => {
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Debug)]
|
||||
#[repr(C)]
|
||||
$($pub)* struct $rust_name {
|
||||
helix: $crate::Metadata,
|
||||
|
|
Loading…
Reference in New Issue