Skip to content

Instantly share code, notes, and snippets.

View moznion's full-sized avatar

moznion moznion

View GitHub Profile
@moznion
moznion / gist:4134247
Created November 23, 2012 06:33
Reinventing shouldFail() part2
import groovy.util.GroovyTestCase
public class Test extends GroovyTestCase {
private shouldFailBy(Class expected, Closure c) {
try {
c.call()
assert false // Failure
} catch (Throwable t) {
assert expected.isInstance(t)
@moznion
moznion / gist:4134250
Created November 23, 2012 06:36
Usage of shouldFail(java.lang.Class clazz, Closure code)
import groovy.util.GroovyTestCase
public class Test extends GroovyTestCase {
public void test() {
shouldFail (NullPointerException) {throw new NullPointerException()}
shouldFail (IllegalAccessError) {throw new IllegalAccessError()}
}
}
@moznion
moznion / gist:4134261
Created November 23, 2012 06:39
Demonstration of powerfulness of shouldFail(Closure code)
import groovy.util.GroovyTestCase
public class Test extends GroovyTestCase {
public void test() {
shouldFail {assert false}
shouldFail {throw new NullPointerException()}
shouldFail {throw new IllegalAccessError()}
}
@moznion
moznion / .proverc
Created November 26, 2012 12:56
Configuration file about prove
-PPretty
--lib
--recurse
--color
--failures
--merge
--trap
--timer
--exec "perl -Ilib -MTest::Name::FromLine"
@moznion
moznion / .shipit
Created December 19, 2012 15:51
Configuration file for ShipIt.
steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist, UploadCPAN
git.tagpattern = %v
git.push_to = origin
@moznion
moznion / json2xml.pl
Last active July 19, 2018 02:05
Convert JSON file to XML file.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.012000;
use autodie;
use XML::XML2JSON;
sub get_json_contents {
@moznion
moznion / maven_ex.sh
Created January 23, 2013 16:07
Expanded maven command (?)
#!/bin/sh
if [ -f pom.json ] ; then
if [ -f pom.xml ] ; then
mv -f pom.xml pom.xml.old
fi
# TODO Specify the own pass to script.
/usr/local/script/json2xml.pl pom.json
fi
@moznion
moznion / .donkirc
Last active December 12, 2015 09:59
My donkirc
default_directory: ~/.donki
repositories:
- [email protected]:moznion/Pod2Readme.git
- [email protected]:moznion/Implement_Trashbox.git
- url: [email protected]:moznion/skeletons4vim.git
name: skeletons
branch: master
target: ~/.vim
- url: [email protected]:moznion/snippets4neosnippet.git
name: snippets
#!/bin/sh
~/.rbenv/shims/ruby ~/.donki/rsense/bin/rsense server
@moznion
moznion / jslint
Last active December 14, 2015 02:29
#!/bin/sh
~/.donki/node/node ~/.donki/jslint-reporter/wrapper.js --verbose $@