shubox 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +57 -0
- data/MIT-LICENSE +22 -0
- data/Manifest.txt +57 -0
- data/PostInstall.txt +6 -0
- data/README.rdoc +128 -0
- data/Rakefile +61 -0
- data/app_generators/clojure/USAGE +15 -0
- data/app_generators/clojure/clojure_generator.rb +46 -0
- data/app_generators/clojure/templates/README.rdoc +29 -0
- data/app_generators/clojure/templates/bin/repl.sh +3 -0
- data/app_generators/clojure/templates/bin/runtests.sh +3 -0
- data/app_generators/clojure/templates/lib/clojure-contrib.jar +0 -0
- data/app_generators/clojure/templates/lib/clojure.jar +0 -0
- data/app_generators/clojure/templates/lib/jline-0.9.94.jar +0 -0
- data/app_generators/clojure/templates/project.iml +19 -0
- data/app_generators/clojure/templates/project.ipr +261 -0
- data/app_generators/clojure/templates/src/repl.clj +3 -0
- data/app_generators/clojure/templates/test/core/about_clojure_testing.clj +21 -0
- data/app_generators/clojure/templates/test/core/about_forms.clj +22 -0
- data/app_generators/clojure/templates/test/tests.clj +11 -0
- data/app_generators/java/USAGE +14 -0
- data/app_generators/java/java_generator.rb +39 -0
- data/app_generators/java/templates/Greeting.java +24 -0
- data/app_generators/java/templates/GreetingTest.java +18 -0
- data/app_generators/java/templates/build.xml +55 -0
- data/app_generators/java/templates/lib/hamcrest-core.jar +0 -0
- data/app_generators/java/templates/lib/junit.jar +0 -0
- data/app_generators/java/templates/project.iml +22 -0
- data/app_generators/java/templates/project.ipr +259 -0
- data/app_generators/ruby/USAGE +12 -0
- data/app_generators/ruby/ruby_generator.rb +37 -0
- data/app_generators/ruby/templates/file.txt +3 -0
- data/app_generators/ruby/templates/rakefile.rb +9 -0
- data/app_generators/ruby/templates/right_triangle.rb +18 -0
- data/app_generators/ruby/templates/shubox.rb +6 -0
- data/app_generators/ruby/templates/test_helper.rb +9 -0
- data/app_generators/ruby/templates/test_io.rb +15 -0
- data/app_generators/ruby/templates/test_right_triangle.rb +21 -0
- data/bin/shubox +24 -0
- data/cleaner_generators/test_unit_cleaner/USAGE +7 -0
- data/cleaner_generators/test_unit_cleaner/lib/test_unit_cleaner.rb +93 -0
- data/cleaner_generators/test_unit_cleaner/templates/clean_test_unit +12 -0
- data/cleaner_generators/test_unit_cleaner/templates/filter_test_unit +13 -0
- data/cleaner_generators/test_unit_cleaner/test_unit_cleaner_generator.rb +27 -0
- data/lib/languages.rb +20 -0
- data/lib/shubox.rb +11 -0
- data/lib/shubox_app_generator.rb +40 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/cleaners/test_test_unit_cleaner.rb +111 -0
- data/test/generators/test_clojure_generator.rb +44 -0
- data/test/generators/test_java_generator.rb +37 -0
- data/test/generators/test_ruby_generator.rb +34 -0
- data/test/lib/test_languages.rb +38 -0
- data/test/test_generator_helper.rb +72 -0
- data/test/test_helper.rb +4 -0
- metadata +144 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="Clojure" name="Clojure">
|
5
|
+
<configuration />
|
6
|
+
</facet>
|
7
|
+
</component>
|
8
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
9
|
+
<exclude-output />
|
10
|
+
<content url="file://$MODULE_DIR$">
|
11
|
+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
12
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
13
|
+
</content>
|
14
|
+
<orderEntry type="inheritedJdk" />
|
15
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
16
|
+
<orderEntry type="library" name="libs" level="project" />
|
17
|
+
</component>
|
18
|
+
</module>
|
19
|
+
|
@@ -0,0 +1,261 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project relativePaths="true" version="4">
|
3
|
+
<component name="AntConfiguration">
|
4
|
+
<defaultAnt bundledAnt="true" />
|
5
|
+
</component>
|
6
|
+
<component name="BuildJarProjectSettings">
|
7
|
+
<option name="BUILD_JARS_ON_MAKE" value="false" />
|
8
|
+
</component>
|
9
|
+
<component name="CodeStyleSettingsManager">
|
10
|
+
<option name="PER_PROJECT_SETTINGS" />
|
11
|
+
<option name="USE_PER_PROJECT_SETTINGS" value="false" />
|
12
|
+
</component>
|
13
|
+
<component name="CompilerConfiguration">
|
14
|
+
<option name="DEFAULT_COMPILER" value="Javac" />
|
15
|
+
<option name="DEPLOY_AFTER_MAKE" value="0" />
|
16
|
+
<resourceExtensions>
|
17
|
+
<entry name=".+\.(properties|xml|html|dtd|tld)" />
|
18
|
+
<entry name=".+\.(gif|png|jpeg|jpg)" />
|
19
|
+
</resourceExtensions>
|
20
|
+
<wildcardResourcePatterns>
|
21
|
+
<entry name="?*.properties" />
|
22
|
+
<entry name="?*.xml" />
|
23
|
+
<entry name="?*.gif" />
|
24
|
+
<entry name="?*.png" />
|
25
|
+
<entry name="?*.jpeg" />
|
26
|
+
<entry name="?*.jpg" />
|
27
|
+
<entry name="?*.html" />
|
28
|
+
<entry name="?*.dtd" />
|
29
|
+
<entry name="?*.tld" />
|
30
|
+
<entry name="?*.ftl" />
|
31
|
+
</wildcardResourcePatterns>
|
32
|
+
</component>
|
33
|
+
<component name="CopyrightManager" default="">
|
34
|
+
<module2copyright />
|
35
|
+
</component>
|
36
|
+
<component name="DependencyValidationManager">
|
37
|
+
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
38
|
+
</component>
|
39
|
+
<component name="EclipseCompilerSettings">
|
40
|
+
<option name="DEBUGGING_INFO" value="true" />
|
41
|
+
<option name="GENERATE_NO_WARNINGS" value="true" />
|
42
|
+
<option name="DEPRECATION" value="false" />
|
43
|
+
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
44
|
+
<option name="MAXIMUM_HEAP_SIZE" value="128" />
|
45
|
+
</component>
|
46
|
+
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
47
|
+
<component name="IdProvider" IDEtalkID="CD12B10C71E44033B2F52F90C08DEF9E" />
|
48
|
+
<component name="InspectionProjectProfileManager">
|
49
|
+
<option name="PROJECT_PROFILE" value="Project Default" />
|
50
|
+
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
51
|
+
<scopes />
|
52
|
+
<profiles>
|
53
|
+
<profile version="1.0" is_locked="false">
|
54
|
+
<option name="myName" value="Project Default" />
|
55
|
+
<option name="myLocal" value="false" />
|
56
|
+
</profile>
|
57
|
+
</profiles>
|
58
|
+
<list size="0" />
|
59
|
+
</component>
|
60
|
+
<component name="JavacSettings">
|
61
|
+
<option name="DEBUGGING_INFO" value="true" />
|
62
|
+
<option name="GENERATE_NO_WARNINGS" value="false" />
|
63
|
+
<option name="DEPRECATION" value="true" />
|
64
|
+
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
65
|
+
<option name="MAXIMUM_HEAP_SIZE" value="128" />
|
66
|
+
</component>
|
67
|
+
<component name="JavadocGenerationManager">
|
68
|
+
<option name="OUTPUT_DIRECTORY" />
|
69
|
+
<option name="OPTION_SCOPE" value="protected" />
|
70
|
+
<option name="OPTION_HIERARCHY" value="true" />
|
71
|
+
<option name="OPTION_NAVIGATOR" value="true" />
|
72
|
+
<option name="OPTION_INDEX" value="true" />
|
73
|
+
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
74
|
+
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
75
|
+
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
76
|
+
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
77
|
+
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
78
|
+
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
79
|
+
<option name="OTHER_OPTIONS" value="" />
|
80
|
+
<option name="HEAP_SIZE" />
|
81
|
+
<option name="LOCALE" />
|
82
|
+
<option name="OPEN_IN_BROWSER" value="true" />
|
83
|
+
</component>
|
84
|
+
<component name="JikesSettings">
|
85
|
+
<option name="JIKES_PATH" value="" />
|
86
|
+
<option name="DEBUGGING_INFO" value="true" />
|
87
|
+
<option name="DEPRECATION" value="true" />
|
88
|
+
<option name="GENERATE_NO_WARNINGS" value="false" />
|
89
|
+
<option name="IS_EMACS_ERRORS_MODE" value="true" />
|
90
|
+
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
91
|
+
</component>
|
92
|
+
<component name="Palette2">
|
93
|
+
<group name="Swing">
|
94
|
+
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
95
|
+
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
96
|
+
</item>
|
97
|
+
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
98
|
+
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
99
|
+
</item>
|
100
|
+
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
101
|
+
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
102
|
+
</item>
|
103
|
+
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
104
|
+
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
105
|
+
</item>
|
106
|
+
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
107
|
+
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
108
|
+
<initial-values>
|
109
|
+
<property name="text" value="Button" />
|
110
|
+
</initial-values>
|
111
|
+
</item>
|
112
|
+
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
113
|
+
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
114
|
+
<initial-values>
|
115
|
+
<property name="text" value="RadioButton" />
|
116
|
+
</initial-values>
|
117
|
+
</item>
|
118
|
+
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
119
|
+
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
120
|
+
<initial-values>
|
121
|
+
<property name="text" value="CheckBox" />
|
122
|
+
</initial-values>
|
123
|
+
</item>
|
124
|
+
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
125
|
+
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
126
|
+
<initial-values>
|
127
|
+
<property name="text" value="Label" />
|
128
|
+
</initial-values>
|
129
|
+
</item>
|
130
|
+
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
131
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
132
|
+
<preferred-size width="150" height="-1" />
|
133
|
+
</default-constraints>
|
134
|
+
</item>
|
135
|
+
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
136
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
137
|
+
<preferred-size width="150" height="-1" />
|
138
|
+
</default-constraints>
|
139
|
+
</item>
|
140
|
+
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
141
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
142
|
+
<preferred-size width="150" height="-1" />
|
143
|
+
</default-constraints>
|
144
|
+
</item>
|
145
|
+
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
146
|
+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
147
|
+
<preferred-size width="150" height="50" />
|
148
|
+
</default-constraints>
|
149
|
+
</item>
|
150
|
+
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
151
|
+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
152
|
+
<preferred-size width="150" height="50" />
|
153
|
+
</default-constraints>
|
154
|
+
</item>
|
155
|
+
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
156
|
+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
157
|
+
<preferred-size width="150" height="50" />
|
158
|
+
</default-constraints>
|
159
|
+
</item>
|
160
|
+
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
161
|
+
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
162
|
+
</item>
|
163
|
+
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
164
|
+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
165
|
+
<preferred-size width="150" height="50" />
|
166
|
+
</default-constraints>
|
167
|
+
</item>
|
168
|
+
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
169
|
+
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
170
|
+
<preferred-size width="150" height="50" />
|
171
|
+
</default-constraints>
|
172
|
+
</item>
|
173
|
+
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
174
|
+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
175
|
+
<preferred-size width="150" height="50" />
|
176
|
+
</default-constraints>
|
177
|
+
</item>
|
178
|
+
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
179
|
+
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
180
|
+
<preferred-size width="200" height="200" />
|
181
|
+
</default-constraints>
|
182
|
+
</item>
|
183
|
+
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
184
|
+
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
185
|
+
<preferred-size width="200" height="200" />
|
186
|
+
</default-constraints>
|
187
|
+
</item>
|
188
|
+
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
189
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
190
|
+
</item>
|
191
|
+
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
192
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
193
|
+
</item>
|
194
|
+
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
195
|
+
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
196
|
+
</item>
|
197
|
+
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
198
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
199
|
+
</item>
|
200
|
+
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
201
|
+
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
202
|
+
<preferred-size width="-1" height="20" />
|
203
|
+
</default-constraints>
|
204
|
+
</item>
|
205
|
+
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
206
|
+
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
207
|
+
</item>
|
208
|
+
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
209
|
+
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
210
|
+
</item>
|
211
|
+
</group>
|
212
|
+
</component>
|
213
|
+
<component name="ProjectDetails">
|
214
|
+
<option name="projectName" value="<%= name %>" />
|
215
|
+
</component>
|
216
|
+
<component name="ProjectFileVersion" converted="true" />
|
217
|
+
<component name="ProjectKey">
|
218
|
+
<option name="state" value="project://<%= destination_root %>/<%= name %>.ipr" />
|
219
|
+
</component>
|
220
|
+
<component name="ProjectModuleManager">
|
221
|
+
<modules>
|
222
|
+
<module fileurl="file://$PROJECT_DIR$/<%= name %>.iml" filepath="$PROJECT_DIR$/<%= name %>.iml" />
|
223
|
+
</modules>
|
224
|
+
</component>
|
225
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6.0_15" project-jdk-type="JavaSDK">
|
226
|
+
<output url="file://$PROJECT_DIR$/out" />
|
227
|
+
</component>
|
228
|
+
<component name="ResourceManagerContainer">
|
229
|
+
<option name="myResourceBundles">
|
230
|
+
<value>
|
231
|
+
<list size="0" />
|
232
|
+
</value>
|
233
|
+
</option>
|
234
|
+
</component>
|
235
|
+
<component name="RmicSettings">
|
236
|
+
<option name="IS_EANABLED" value="false" />
|
237
|
+
<option name="DEBUGGING_INFO" value="true" />
|
238
|
+
<option name="GENERATE_NO_WARNINGS" value="false" />
|
239
|
+
<option name="GENERATE_IIOP_STUBS" value="false" />
|
240
|
+
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
|
241
|
+
</component>
|
242
|
+
<component name="SvnBranchConfigurationManager">
|
243
|
+
<option name="mySupportsUserInfoFilter" value="true" />
|
244
|
+
</component>
|
245
|
+
<component name="VcsDirectoryMappings">
|
246
|
+
<mapping directory="" vcs="Git" />
|
247
|
+
</component>
|
248
|
+
<component name="WebServicesPlugin" addRequiredLibraries="true" />
|
249
|
+
<component name="libraryTable">
|
250
|
+
<library name="libs">
|
251
|
+
<CLASSES>
|
252
|
+
<root url="jar://$PROJECT_DIR$/lib/jline-0.9.94.jar!/" />
|
253
|
+
<root url="jar://$PROJECT_DIR$/lib/clojure.jar!/" />
|
254
|
+
<root url="jar://$PROJECT_DIR$/lib/clojure-contrib.jar!/" />
|
255
|
+
</CLASSES>
|
256
|
+
<JAVADOC />
|
257
|
+
<SOURCES />
|
258
|
+
</library>
|
259
|
+
</component>
|
260
|
+
</project>
|
261
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
(ns core.about_clojure_testing
|
2
|
+
(:use clojure.test))
|
3
|
+
|
4
|
+
; Define a simple "Hello, World" function to test
|
5
|
+
(defn hello [name]
|
6
|
+
(str "Hello, " name "!"))
|
7
|
+
|
8
|
+
; use 'is' for single condition assertions
|
9
|
+
(deftest hello-world
|
10
|
+
(is (= "Hello, World!" (hello "World"))))
|
11
|
+
|
12
|
+
(deftest simple-addition
|
13
|
+
(is (= 4 (+ 2 2))))
|
14
|
+
|
15
|
+
; use 'are' for a set of data to pass in with similar conditions
|
16
|
+
(deftest squares-using-are
|
17
|
+
(are [expected x] (= (* x x))
|
18
|
+
1 1
|
19
|
+
4 2
|
20
|
+
4 -2
|
21
|
+
9 3))
|
@@ -0,0 +1,22 @@
|
|
1
|
+
(ns core.about_forms
|
2
|
+
(:use clojure.test))
|
3
|
+
|
4
|
+
(deftest division-in-clojure-is-surprising
|
5
|
+
(are [expression expected] (= expression expected)
|
6
|
+
(/ 6 3) 2
|
7
|
+
; Ratio is a built-in type
|
8
|
+
(/ 3 6) 1/2
|
9
|
+
; use a floating-point literal for the dividend for decimal division
|
10
|
+
(/ 3.0 6) 0.5
|
11
|
+
; integer quotient
|
12
|
+
(quot 22 7) 3
|
13
|
+
; remainder
|
14
|
+
(rem 22 7) 1
|
15
|
+
))
|
16
|
+
|
17
|
+
(deftest strings
|
18
|
+
(are [expression expected] (= expression expected)
|
19
|
+
(.toUpperCase "str") "STR"
|
20
|
+
(str 1 2 nil 3) "123"
|
21
|
+
))
|
22
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Description:
|
2
|
+
|
3
|
+
shubox lowers the barrier to entry for test-driven learning by providing a basic infrastructure in which
|
4
|
+
to start coding: A directory structure, some classes and unit tests to get started, and a build script
|
5
|
+
to run all tests.
|
6
|
+
|
7
|
+
Usage:
|
8
|
+
|
9
|
+
$ shubox -l=java /tmp/LearnJava
|
10
|
+
$ cd /tmp/LearnJava
|
11
|
+
$ ant -f build/build.xml
|
12
|
+
|
13
|
+
If you have IntelliJ, open the IPR file to get started with adding your learning tests. If you have
|
14
|
+
a different IDE, follow the instructions to import your application as existing source.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'shubox_app_generator'
|
2
|
+
|
3
|
+
class JavaGenerator < ShuboxAppGenerator
|
4
|
+
|
5
|
+
def manifest
|
6
|
+
record do |m|
|
7
|
+
# Ensure appropriate folder(s) exists
|
8
|
+
m.directory ''
|
9
|
+
BASEDIRS.each { |path| m.directory path }
|
10
|
+
|
11
|
+
# root
|
12
|
+
m.template("project.ipr", "#{@name}.ipr")
|
13
|
+
m.file("project.iml", "#{@name}.iml")
|
14
|
+
|
15
|
+
# build
|
16
|
+
m.template("build.xml", "build/build.xml")
|
17
|
+
|
18
|
+
# lib
|
19
|
+
m.file_copy_each %w(hamcrest-core.jar junit.jar), "lib"
|
20
|
+
|
21
|
+
# src
|
22
|
+
m.directory "src/com/samples"
|
23
|
+
m.file("Greeting.java", "src/com/samples/Greeting.java")
|
24
|
+
|
25
|
+
# test
|
26
|
+
m.directory "test/com/samples"
|
27
|
+
m.file("GreetingTest.java", "test/com/samples/GreetingTest.java")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
# Installation skeleton.
|
33
|
+
BASEDIRS = %w(
|
34
|
+
build
|
35
|
+
lib
|
36
|
+
src
|
37
|
+
test
|
38
|
+
)
|
39
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
package com.samples;
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Understands how to greet in several languages
|
5
|
+
*/
|
6
|
+
public class Greeting {
|
7
|
+
private final String subject;
|
8
|
+
|
9
|
+
public Greeting(String subject) {
|
10
|
+
this.subject = ", " + subject + "!";
|
11
|
+
}
|
12
|
+
|
13
|
+
public String english() {
|
14
|
+
return "Hello" + subject;
|
15
|
+
}
|
16
|
+
|
17
|
+
public String espanol() {
|
18
|
+
return "Hola" + subject;
|
19
|
+
}
|
20
|
+
|
21
|
+
public String farsi() {
|
22
|
+
return "Salam" + subject;
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
package com.samples;
|
2
|
+
|
3
|
+
import org.junit.Test;
|
4
|
+
import static org.junit.Assert.assertThat;
|
5
|
+
import static org.hamcrest.CoreMatchers.is;
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Tests our toy class; ensures we have everything wired together.
|
9
|
+
*/
|
10
|
+
public class GreetingTest {
|
11
|
+
|
12
|
+
@Test
|
13
|
+
public void shouldSayHi() {
|
14
|
+
assertThat(new Greeting("World").english(), is("Hello, World!"));
|
15
|
+
assertThat(new Greeting("Donia").farsi(), is("Salam, Donia!"));
|
16
|
+
assertThat(new Greeting("Miami").espanol(), is("Hola, Miami!"));
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<project default="all" basedir=".." name="<%= name %>">
|
3
|
+
|
4
|
+
<property name="message" value="Building the project...."/>
|
5
|
+
<property name="src" location="src"/>
|
6
|
+
<property name="test" location="test"/>
|
7
|
+
<property name="out" location="out"/>
|
8
|
+
<property name="dist" location="dist"/>
|
9
|
+
<property name="lib" location="lib"/>
|
10
|
+
<property name="results" location="dist/results"/>
|
11
|
+
|
12
|
+
<path id="test.lib">
|
13
|
+
<pathelement location="${lib}/junit.jar"/>
|
14
|
+
<pathelement location="${lib}/hamcrest-core.jar"/>
|
15
|
+
<pathelement location="${out}" />
|
16
|
+
</path>
|
17
|
+
|
18
|
+
<target name="all" depends="clean, init, compile, test, compress" description="Run all targets" />
|
19
|
+
|
20
|
+
<target name="clean" description="Remove working directories">
|
21
|
+
<delete dir="${dist}"/>
|
22
|
+
<delete dir="${out}"/>
|
23
|
+
</target>
|
24
|
+
|
25
|
+
<target name="init">
|
26
|
+
<mkdir dir="${out}"/>
|
27
|
+
<mkdir dir="${dist}"/>
|
28
|
+
<mkdir dir="${results}"/>
|
29
|
+
</target>
|
30
|
+
|
31
|
+
<target name="compile">
|
32
|
+
<javac srcdir="${src}" destdir="${out}"/>
|
33
|
+
<javac srcdir="${test}" destdir="${out}">
|
34
|
+
<classpath refid="test.lib" />
|
35
|
+
</javac>
|
36
|
+
</target>
|
37
|
+
|
38
|
+
<target name="test" depends="compile">
|
39
|
+
<junit printsummary="yes" haltonfailure="yes">
|
40
|
+
<formatter type="brief" usefile="false"/>
|
41
|
+
<classpath refid="test.lib"/>
|
42
|
+
<batchtest>
|
43
|
+
<fileset dir="${out}" includes="**/*Test.class"/>
|
44
|
+
</batchtest>
|
45
|
+
</junit>
|
46
|
+
</target>
|
47
|
+
|
48
|
+
<target name="compress">
|
49
|
+
<jar destfile="${dist}/${ant.project.name}.jar" basedir="${out}">
|
50
|
+
<include name="**/*.class"/>
|
51
|
+
<exclude name="**/*Test.class"/>
|
52
|
+
</jar>
|
53
|
+
</target>
|
54
|
+
|
55
|
+
</project>
|