Commit b6fa4dd1 authored by Alex Crichton's avatar Alex Crichton

Fix expanded code in 2018 projects

This commit moves all tests to being compiled with the 2018 edition, and
adds one standlone test which is compiled with the 2015 edition. One
`use` statement needed an update but otherwise everything looks like
it's good to go for 2018!

Closes #35
parent a2148ad5
......@@ -61,53 +61,5 @@ libc = "0.2"
members=["mixed_tests" ]
[[test]]
name = "argument-types"
edition = "2015"
[[test]]
name = "basic"
edition = "2015"
[[test]]
name = "c_derive"
edition = "2015"
[[test]]
name = "drop"
edition = "2015"
[[test]]
name = "floating-refs"
edition = "2015"
[[test]]
name = "interfaces"
edition = "2015"
[[test]]
name = "memory-layout"
edition = "2015"
[[test]]
name = "no-instance-private"
edition = "2015"
[[test]]
name = "override"
edition = "2015"
[[test]]
name = "properties"
edition = "2015"
[[test]]
name = "signals"
edition = "2015"
[[test]]
name = "gir"
edition = "2015"
[[test]]
name = "variant"
name = "works-in-2015"
edition = "2015"
......@@ -189,8 +189,8 @@ impl<'ast, T: Boilerplate<'ast>> BoilerplateExt<'ast> for T {
}
pub use #ModuleName::*;
pub use #ModuleName::imp::#instance_ext;
pub use self::#ModuleName::*;
pub use self::#ModuleName::imp::#instance_ext;
}
}
......
......@@ -2,7 +2,7 @@ use super::boilerplate;
use super::SlotExt;
use crate::gen::boilerplateext::BoilerplateExt;
use proc_macro2::TokenStream;
use quote::{ToTokens, quote};
use quote::{quote, ToTokens};
use std::marker::PhantomData;
/// This class can generate the public part of the boilerplate code for objects
......
......@@ -3,7 +3,7 @@ use crate::gen::signals;
use crate::hir::names::Names;
use crate::hir::{FnSig, Method, Signal, Slot, VirtualMethod};
use proc_macro2::TokenStream;
use quote::{ToTokens, quote};
use quote::{quote, ToTokens};
pub trait SlotExt {
fn trait_definition(&self) -> TokenStream;
......
extern crate gobject_gen;
extern crate gobject_gen_test;
extern crate libc;
#[macro_use]
extern crate glib;
use gobject_gen::gobject_gen;
use std::cell::Cell;
gobject_gen! {
class Counter {
f: Cell<u32>,
}
impl Counter {
pub fn add(&self, x: u32) -> u32 {
self.get_priv().f.set(self.get() + x);
self.get()
}
pub fn get(&self) -> u32 {
self.get_priv().f.get()
}
}
}
#[test]
fn test() {
let c: Counter = Counter::new();
c.add(2);
c.add(20);
assert_eq!(c.get(), 22);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment