Skip to content
This repository
Browse code

off by one

  • Loading branch information...
commit cfdaa2a83975c562bf45c0e2453a779de809cd23 1 parent 1b67a42
JP Moresmau authored December 04, 2012
20  ...sefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/editors/cabal/forms/stanzas/TestSuitesPage.java
@@ -131,6 +131,24 @@ public void addStanza(final PackageDescription desc,final String pref,final Test
131 131
        */
132 132
       if (needLibrary){
133 133
         pd.addToPropertyList( CabalSyntax.FIELD_BUILD_DEPENDS, desc.getPackageStanza().getName() );
  134
+        String value=desc.getPackageStanza().getProperties().get(CabalSyntax.FIELD_CABAL_VERSION);
  135
+        if (value!=null){
  136
+          if (value.startsWith( ">=" )) {
  137
+            value=value.substring( 2 ).trim();
  138
+          }
  139
+          if (value.length()>0 ){
  140
+            try {
  141
+              double d=Double.parseDouble( value );
  142
+              if (d<1.8){
  143
+                desc.getPackageStanza().update( CabalSyntax.FIELD_CABAL_VERSION, ">=1.8" );
  144
+              }
  145
+            } catch (NumberFormatException nfe){
  146
+              HaskellUIPlugin.log( nfe );
  147
+            }
  148
+          }
  149
+        } else {
  150
+          desc.getPackageStanza().update( CabalSyntax.FIELD_CABAL_VERSION, ">=1.8" );
  151
+        }
134 152
       }
135 153
 
136 154
       /**
@@ -220,7 +238,7 @@ private String createTestModule(final PackageDescriptionStanza pd,final TestSuit
220 238
      */
221 239
     mci.setModuleName( mods[mods.length-1] );
222 240
     if (mods.length>1){
223  
-      mci.setFolders( new Path(LangUtil.join( Arrays.asList( mods ).subList( 0, mods.length-2 ), "/" )));
  241
+      mci.setFolders( new Path(LangUtil.join( Arrays.asList( mods ).subList( 0, mods.length-1 ), "/" )));
224 242
     }
225 243
     mci.setSourceContainer( def.getSrc() );
226 244
     mci.setProject( sourceDirsSection.getProject() );

0 notes on commit cfdaa2a

Please sign in to comment.
Something went wrong with that request. Please try again.