Skip to content

Commit

Permalink
regenerate spec
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbenz committed Mar 12, 2014
1 parent 07bc71f commit 66fc46c
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 52 deletions.
56 changes: 32 additions & 24 deletions examples/org.jnario.examples/doc-gen/diverse/StackSpec.html
Expand Up @@ -36,45 +36,53 @@ <h1>Stack</h1>
<div class="tab-content">
<div class="tab-pane active" id="spec">
<h3 class="exampleGroup notrun" id="empty">Empty</h3>
<ul><li><p id="emptyStack_size_should_be_0" class="example notrun"><strong>emptyStack.size should be 0</strong></p>
</li><li><p id="emptyStack_pop_throws_EmptyStackException" class="example notrun"><strong>emptyStack.pop throws EmptyStackException</strong></p>
<ul><li><p id="subject_empty_should_be_true" class="example notrun"><strong>subject.empty should be true</strong></p>
</li><li><p id="subject_pop_throws_EmptyStackException" class="example notrun"><strong>subject.pop[] throws EmptyStackException</strong></p>
</li></ul>
<h3 class="exampleGroup notrun" id="not_empty">Not empty</h3>
<ul><li><p id="pop_removes_last_element" class="example notrun"><strong>pop removes last element</strong></p>
<ul><li><p id="increases_size_when_pushing" class="example notrun"><strong>increases size when pushing</strong></p>
<pre class="prettyprint lang-spec linenums">
val stack = new Stack&lt;String&gt;
stack.add(&quot;something&quot;)
stack.pop =&gt; &quot;something&quot;</pre>
subject.push(&quot;something&quot;)
subject.size =&gt; 1</pre>
</li><li><p id="decreases_size_when_popping" class="example notrun"><strong>decreases size when popping</strong></p>
<pre class="prettyprint lang-spec linenums">
subject.push(&quot;something&quot;)
subject.pop()
subject.size =&gt; 0</pre>
</li></ul>
</div>
<div class="tab-pane" id="source">
<h3>Example1.spec</h3>
<h3>Stack.spec</h3>
<p>
<pre class="prettyprint lang-spec linenums">
/*******************************************************************************
* Copyright (c) 2012 BMW Car IT and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package diverse

import java.util.Stack
import java.util.EmptyStackException
import java.util.Stack

describe Stack{

context &quot;empty&quot;{
val emptyStack = new Stack&lt;String&gt;

fact emptyStack.size should be 0
fact emptyStack.pop throws EmptyStackException

}

context &quot;not empty&quot;{

fact &quot;pop removes last element&quot;{
val stack = new Stack&lt;String&gt;
stack.add(&quot;something&quot;)
stack.pop =&gt; &quot;something&quot;
}

fact subject.empty should be true
fact subject.pop() throws EmptyStackException
}
context &quot;not empty&quot;{
fact &quot;increases size when pushing&quot;{
subject.push(&quot;something&quot;)
subject.size =&gt; 1
}
fact &quot;decreases size when popping&quot;{
subject.push(&quot;something&quot;)
subject.pop()
subject.size =&gt; 0
}
}
}
</pre>
</p></div>
Expand Down
34 changes: 19 additions & 15 deletions examples/org.jnario.examples/xtend-gen/diverse/StackEmptySpec.java
@@ -1,44 +1,48 @@
/**
* Copyright (c) 2012 BMW Car IT and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package diverse;

import diverse.StackSpec;
import java.util.EmptyStackException;
import java.util.Stack;
import org.jnario.lib.Assert;
import org.jnario.lib.Should;
import org.jnario.runner.ExampleGroupRunner;
import org.jnario.runner.Named;
import org.jnario.runner.Order;
import org.jnario.runner.Subject;
import org.junit.Test;
import org.junit.runner.RunWith;

@Named("empty")
@RunWith(ExampleGroupRunner.class)
@SuppressWarnings("all")
public class StackEmptySpec extends StackSpec {
final Stack<String> emptyStack = new Stack<String>();
@Subject
public Stack subject;

@Test
@Named("emptyStack.size should be 0")
@Named("subject.empty should be true")
@Order(1)
public void _emptyStackSizeShouldBe0() throws Exception {
int _size = this.emptyStack.size();
boolean _should_be = Should.<Integer>should_be(Integer.valueOf(_size), Integer.valueOf(0));
Assert.assertTrue("\nExpected emptyStack.size should be 0 but"
+ "\n emptyStack.size is " + new org.hamcrest.StringDescription().appendValue(Integer.valueOf(_size)).toString()
+ "\n emptyStack is " + new org.hamcrest.StringDescription().appendValue(this.emptyStack).toString() + "\n", _should_be);

public void _subjectEmptyShouldBeTrue() throws Exception {
throw new Error("Unresolved compilation problems:"
+ "\nAmbiguous feature call.\nThe methods\n\tempty() in Stack and\n\tisEmpty() in Vector\nboth match.");
}

@Test
@Named("emptyStack.pop throws EmptyStackException")
@Named("subject.pop[] throws EmptyStackException")
@Order(2)
public void _emptyStackPopThrowsEmptyStackException() throws Exception {
public void _subjectPopThrowsEmptyStackException() throws Exception {
boolean expectedException = false;
String message = "";
try{
this.emptyStack.pop();
message = "Expected " + EmptyStackException.class.getName() + " for \n emptyStack.pop\n with:"
+ "\n emptyStack is " + new org.hamcrest.StringDescription().appendValue(this.emptyStack).toString();
this.subject.pop();
message = "Expected " + EmptyStackException.class.getName() + " for \n subject.pop()\n with:"
+ "\n subject is " + new org.hamcrest.StringDescription().appendValue(this.subject).toString();
}catch(EmptyStackException e){
expectedException = true;
}
Expand Down
@@ -1,3 +1,10 @@
/**
* Copyright (c) 2012 BMW Car IT and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package diverse;

import diverse.StackSpec;
Expand All @@ -7,23 +14,39 @@
import org.jnario.runner.ExampleGroupRunner;
import org.jnario.runner.Named;
import org.jnario.runner.Order;
import org.jnario.runner.Subject;
import org.junit.Test;
import org.junit.runner.RunWith;

@Named("not empty")
@RunWith(ExampleGroupRunner.class)
@SuppressWarnings("all")
public class StackNotEmptySpec extends StackSpec {
@Subject
public Stack subject;

@Test
@Named("pop removes last element")
@Named("increases size when pushing")
@Order(1)
public void _popRemovesLastElement() throws Exception {
final Stack<String> stack = new Stack<String>();
stack.add("something");
String _pop = stack.pop();
Assert.assertTrue("\nExpected stack.pop => \"something\" but"
+ "\n stack.pop is " + new org.hamcrest.StringDescription().appendValue(_pop).toString()
+ "\n stack is " + new org.hamcrest.StringDescription().appendValue(stack).toString() + "\n", Should.<String>operator_doubleArrow(_pop, "something"));
public void _increasesSizeWhenPushing() throws Exception {
this.subject.push("something");
int _size = this.subject.size();
Assert.assertTrue("\nExpected subject.size => 1 but"
+ "\n subject.size is " + new org.hamcrest.StringDescription().appendValue(Integer.valueOf(_size)).toString()
+ "\n subject is " + new org.hamcrest.StringDescription().appendValue(this.subject).toString() + "\n", Should.<Integer>operator_doubleArrow(Integer.valueOf(_size), Integer.valueOf(1)));

}

@Test
@Named("decreases size when popping")
@Order(2)
public void _decreasesSizeWhenPopping() throws Exception {
this.subject.push("something");
this.subject.pop();
int _size = this.subject.size();
Assert.assertTrue("\nExpected subject.size => 0 but"
+ "\n subject.size is " + new org.hamcrest.StringDescription().appendValue(Integer.valueOf(_size)).toString()
+ "\n subject is " + new org.hamcrest.StringDescription().appendValue(this.subject).toString() + "\n", Should.<Integer>operator_doubleArrow(Integer.valueOf(_size), Integer.valueOf(0)));

}
}
7 changes: 7 additions & 0 deletions examples/org.jnario.examples/xtend-gen/diverse/StackSpec.java
@@ -1,3 +1,10 @@
/**
* Copyright (c) 2012 BMW Car IT and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package diverse;

import diverse.StackEmptySpec;
Expand Down
Expand Up @@ -8,7 +8,6 @@
package org.jnario.suite.ui.highlighting;

import java.util.Arrays;

import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
Expand All @@ -24,6 +23,7 @@
import org.jnario.suite.suite.SpecReference;
import org.jnario.suite.suite.Suite;
import org.jnario.suite.suite.SuitePackage;
import org.jnario.suite.ui.highlighting.SuiteHighlightingConfiguration;
import org.jnario.util.Strings;

@SuppressWarnings("all")
Expand Down
Expand Up @@ -7,8 +7,8 @@
*/
package org.jnario.suite.ui.hover;

import com.google.inject.Inject;
import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.IRegion;
import org.eclipse.xtend2.lib.StringConcatenation;
Expand All @@ -19,8 +19,6 @@
import org.jnario.suite.suite.PatternReference;
import org.jnario.ui.doc.JnarioHoverProvider;

import com.google.inject.Inject;

@SuppressWarnings("all")
public class SuiteHoverProvider extends JnarioHoverProvider {
@Inject
Expand Down
2 changes: 1 addition & 1 deletion plugins/org.jnario.ui/META-INF/MANIFEST.MF
Expand Up @@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.ui,
org.eclipse.jdt.junit,
org.eclipse.xtext.ui.shared;bundle-version="[2.5.3,2.6.0)",
org.eclipse.xtext.ui.codetemplates.ui;bundle-version="2.5.1";visibility:=reexport
org.eclipse.xtext.ui.codetemplates.ui;bundle-version="2.5.3";visibility:=reexport
Bundle-ActivationPolicy: lazy
Export-Package: org.jnario.ui,
org.jnario.ui.builder,
Expand Down

0 comments on commit 66fc46c

Please sign in to comment.