From a35ecc6f94f7298c77458a2d5fc11c2ba23a4eb4 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 30 Jun 2017 02:04:09 -0400 Subject: [PATCH] Test parameterized traits with named staging object * test/Trait/NamedTest.js: Add regression test. Update copyright to include 2017. --- test/Trait/NamedTest.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/Trait/NamedTest.js b/test/Trait/NamedTest.js index c3f287c..19505cb 100644 --- a/test/Trait/NamedTest.js +++ b/test/Trait/NamedTest.js @@ -1,7 +1,7 @@ /** * Tests named trait definitions * - * Copyright (C) 2014, 2016 Free Software Foundation, Inc. + * Copyright (C) 2014, 2016, 2017 Free Software Foundation, Inc. * * This file is part of GNU ease.js. * @@ -209,4 +209,25 @@ require( 'common' ).testCase( // ensure that trait was properly named this.assertOk( T.toString().match( name ) ); }, + + + /** + * This is a regression test for a bug whereby `#__mixin' was not + * properly detected when extending a class, preventing a trait from + * becoming parameterized. This was actually fixed when implementing + * named trait extending (and noticed on a version that did not have it + * implemented), but it's still an important test. + */ + 'Can create parameterized trait using named staging object': function() + { + var C = this.Class( {} ); + + this.assertOk( this.Sut.isParameterTrait( + this.Sut( 'Foo' ).extend( C, + { + // makes it parameterized + __mixin: function() {}, + } ) + ) ); + }, } );