#!/bin/sh # script/test: Run test suite for application. Optionally pass in a path to an # individual test file to run a single test. set -e cd "$[dirname $0]/.." test -z $DEBUG || set -x global RACK_ROOT := $[cd "$[dirname $0]"/.. && pwd] export RACK_ROOT if test $RAILS_ENV = "test" || test $RACK_ENV = "test" { # if executed and the environment is already set to `test`, then we want a # clean from scratch application. This almost always means a ci environment, # since we set the environment to `test` directly in `script/cibuild`. script/setup } else { # if the environment isn't set to `test`, set it to `test` and update the # application to ensure all dependencies are met as well as any other things # that need to be up to date, like db migrations. The environment not having # already been set to `test` almost always means this is being called on it's # own from a `development` environment. export RAILS_ENV="test" RACK_ENV="test" script/update } echo "==> Running tests…" if test -n $1 { # pass arguments to test call. This is useful for calling a single test. bin/rake test $1 } else { bin/rake test } (CommandList children: [ (C {(set)} {(-e)}) (C {(cd)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(dirname)} {(DQ ($ VSub_Number "$0"))})]) left_token: spids: [20 26] ) (/..) ) } ) (AndOr children: [ (C {(Lit_Other "[")} {(-z)} {(DQ ($ VSub_Name "$DEBUG"))} {(Lit_Other "]")}) (C {(set)} {(-x)}) ] op_id: Op_DPipe ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RACK_ROOT) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(cd)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ ($ VSub_Number "$0"))})] ) left_token: spids: [54 60] ) ) (/..) } ) (C {(pwd)}) ] op_id: Op_DAmp ) ] ) left_token: spids: [50 67] ) ) } spids: [48] ) ] spids: [48] ) (C {(export)} {(RACK_ROOT)}) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$RAILS_ENV"))} {(Lit_Other "=")} {(DQ (test))} {(Lit_Other "]")} ) (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$RACK_ENV"))} {(Lit_Other "=")} {(DQ (test))} {(Lit_Other "]")} ) ] op_id: Op_DPipe ) terminator: ) ] action: [(C {(script/setup)})] spids: [-1 108] ) ] else_action: [ (C {(export)} {(Lit_VarLike "RAILS_ENV=") (DQ (test))} {(Lit_VarLike "RACK_ENV=") (DQ (test))}) (C {(script/update)}) ] spids: [125 164] ) (C {(echo)} {(DQ ("==> Running tests\u2026"))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-n)} {(DQ ($ VSub_Number "$1"))} {(Lit_Other "]")}) terminator: ) ] action: [(C {(bin/rake)} {(test)} {(DQ ($ VSub_Number "$1"))})] spids: [-1 187] ) ] else_action: [(C {(bin/rake)} {(test)})] spids: [202 209] ) ] )